0

How can i take numbers out of string when there is blank between them ?

5th Jan 2017, 12:54 PM
Ć imon Pavlas
Ć imon Pavlas - avatar
3 Answers
+ 1
String string = "hello 034556"; String[] parts = string.split(" "); String part1 = parts[0]; // hello int part2 = parts[1]; // 034556
5th Jan 2017, 1:09 PM
Sharique Ansari
Sharique Ansari - avatar
+ 1
sry, that code will show error, you will need to change string to integer first hope this helps String x="hello 5658"; String[] parts=x.split(" "); String part1=parts[0]; int part2=Integer.parseInt(parts[1]); System.out.println(part1);//hello System.out.println(part2);//5658
5th Jan 2017, 1:19 PM
Sharique Ansari
Sharique Ansari - avatar
0
thx mate â˜ș
5th Jan 2017, 1:11 PM
Ć imon Pavlas
Ć imon Pavlas - avatar