+ 1
How does the split method work for strings? Please provide a simple example or more. Thank you
4 Answers
+ 1
the split method splits a String using a seperator as parameter. it returns the seperated parts inside an String-Array.
example:
String sentence = "hey you!";
String[] words = sentence.split(" ");
+ 1
So in this case what is the result of words?
+ 1
the result would be
{"hey", "you!"}
+ 1
Amazing thank you