0

How to split a String into separate Strings?

How to - 'My Name is Shashank' to 'My name is' and 'Shashank'

21st May 2020, 10:50 AM
DOT X
DOT X - avatar
4 Réponses
+ 1
String name = "My name is .."; name.split(" ' ' ");
21st May 2020, 11:05 AM
Shahghasi Adil
Shahghasi Adil - avatar
0
Is "my name is" are const on all cases?
21st May 2020, 10:54 AM
ycsvenom
ycsvenom - avatar
0
Yes
21st May 2020, 10:55 AM
DOT X
DOT X - avatar
0
Then you can just make sub string start from the index of the name because it's const
21st May 2020, 10:56 AM
ycsvenom
ycsvenom - avatar