package com.rwsfs.test;
public class Test {
public static void main(String[] args) {
String s="My name is khan and i am not a terrorist";
String newString=s.replaceAll("\\s","");
System.out.println("Original String = "+s);
System.out.println("New String = "+newString);
}
}
How do you remove all white spaces from a string in java? |
Thanks for sharing bro... keep it up
ReplyDeleteThanks a lot bro its very helpful...
ReplyDelete