Is it possible to do something like this so that it is valid from the text
the boy said "hi" put the word in quotes on the say line?
Is it possible to do something like this so that it is valid from the text
the boy said "hi" put the word in quotes on the say line?
Yes you can.
Solution to the forehead :
String str = "мальчик сказал \"привет\""; int p1 = str.indexOf("\"") + 1; int p2 = str.indexOf("\"", p1); String say = str.substring(p1, p2); Here, the str line searches for the position of the first quote, then searches for the position of the quote after the first quote found.
Then, using the String.substring(...) method, the required substring is obtained from the str string.
Source: https://ru.stackoverflow.com/questions/619471/
All Articles