+ 2

I want to split strings in JAVA ?

I have a text.For eg: 134 SW OF TEXAS, US /* I have to separate the string after 'OF' and save it into two different string..how can I do that **/ 134 SW OF into a String and TEXAS, US into a different String ??

3rd Aug 2018, 1:24 PM
Rishabh
Rishabh - avatar
9 odpowiedzi
3rd Aug 2018, 1:56 PM
Jonathan Pizarra (JS Challenger)
Jonathan Pizarra (JS Challenger) - avatar
+ 8
https://code.sololearn.com/c2PYIvz3UW3Z/?ref=app
3rd Aug 2018, 1:30 PM
Muhd Khairul Amirin
Muhd Khairul Amirin - avatar
+ 7
Maybe you can use String str="134 SW OF TEXAS, US"; String[] arr= str.split("OF"); String a=arr[0]; String b=arr[1];
3rd Aug 2018, 1:34 PM
Muhd Khairul Amirin
Muhd Khairul Amirin - avatar
+ 4
Sorry, I posted the wrong link earlier.😅
3rd Aug 2018, 2:00 PM
Jonathan Pizarra (JS Challenger)
Jonathan Pizarra (JS Challenger) - avatar
+ 3
thanks JonathanP
3rd Aug 2018, 1:59 PM
Rishabh
Rishabh - avatar
+ 3
Anyone have more ideas to do this JonathanP Muhd Khairul Amirin Bin Yaacob
3rd Aug 2018, 2:03 PM
Rishabh
Rishabh - avatar
+ 2
thanks Muhd Khairul Amirin Bin Yaacob but I'm looking for another way to do it!!
3rd Aug 2018, 1:31 PM
Rishabh
Rishabh - avatar
+ 2
the method in your code & this code u have written are based on same concepts ..I'm looking for something different Muhd Khairul Amirin Bin Yaacob
3rd Aug 2018, 1:36 PM
Rishabh
Rishabh - avatar
+ 1
😒😒😒😒😒 JonathanP
3rd Aug 2018, 2:01 PM
Rishabh
Rishabh - avatar