+ 1

How does the split method work for strings? Please provide a simple example or more. Thank you

14th Mar 2020, 8:45 AM
Alex Schmidt
Alex Schmidt - avatar
4 Respuestas
+ 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(" ");
14th Mar 2020, 9:03 AM
Anton Böhler
Anton Böhler - avatar
+ 1
So in this case what is the result of words?
14th Mar 2020, 9:06 AM
Alex Schmidt
Alex Schmidt - avatar
+ 1
the result would be {"hey", "you!"}
14th Mar 2020, 9:07 AM
Anton Böhler
Anton Böhler - avatar
+ 1
Amazing thank you
14th Mar 2020, 9:08 AM
Alex Schmidt
Alex Schmidt - avatar