Hello
I have the following:
String somestring="203/9834/345";
somestring.replace("/","");
System.out.println(somestring);
But it does not remove the slashes. How can I remove them?
Thanks
Hello
I have the following:
String somestring="203/9834/345";
somestring.replace("/","");
System.out.println(somestring);
But it does not remove the slashes. How can I remove them?
Thanks
Strings in Java are immutable - ie their content never changes. The replace method therefore does not change the original String. It returns a new String that has the replacements made...
String somestring="203/9834/345";
String replaced = somestring.replace("/","");
System.out.println(replaced);
That was it JamesCherrill
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.