0
How can i take numbers out of string when there is blank between them ?
3 Réponses
+ 1
String string = "hello 034556";
String[] parts = string.split(" ");
String part1 = parts[0]; // hello
int part2 = parts[1]; // 034556
+ 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
0
thx mate ☺