0
How to remove a char from string? JAVA
Hello everyone I want to know how can I remove ','s from (for ex.) "42,32,55,77" and add those numbers in an array.
4 ответов
+ 2
It's called splitting.
String[] parts = myString.split(",");
You'll then have to convert the strings to numbers manually if you need to. One way to do it is
List<Integer> myListOfNumbers = Arrays.stream(parts).map(Integer::parseInt).collect(Collectors.toList());
+ 1
String Str = new String("1,2,3,4,5");
Str = Str.replace(',', '');
//it's for remove ','
0
What about array?
0
oh I have founded the split and wanted to ask about making them integers and I have got this message. Thanks a lot guys!