When working with text you have to know about the functions which can manipulate text.
Say we have the text
String hString = `Hello world and especially during carnaval`
And we want to have the seperated words in a list
String hString = "tester and rester";
String[] StringElements = split(hString, " ");
for (int i =0; i< StringElements.length ;i++) println( StringElements[i] ); we have the function split this gives an array which as elements the words if you use the space as a delimiter.
String hString = "tester";
println( hString.length());
To find a specific word the function indexOf is used
String hString = "tester";
println( hString.indexOf("ster"));
This can be useful extraction words from a twitterstream and doing something with these special words.
Aucun commentaire:
Enregistrer un commentaire