Answer the question
In order to leave comments, you need to log in
How to get the first and second word into variables from a String?
I can't find a solution at all. I recognize the string with the scanner, let's say "Hello, huge world!", To the str1 variable. You need to get the first word from the str1 variable into the str2 variable (str2 = "Hello"), and then the second word into the str3 variable (str3 = "huge")
PS I could split the entire string into words into an array and get both the first and second value, but in my case, where there can be 50 words in a variable, I don’t want to do this
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question