remove blank spaces in string java code example
Example 1: java 8 remove spaces from string
a.replaceAll("\\s+","");
Example 2: java remove space at the end of string
String str = "Hello ";
System.out.println(str.trim()); // "Hello"
a.replaceAll("\\s+","");
String str = "Hello ";
System.out.println(str.trim()); // "Hello"