cara menghapus semua whitespace dari string java
st = st.replaceAll("\\s+","")
a PROgrammer
st = st.replaceAll("\\s+","")
a.replaceAll("\\s+","");
String str = "Hello ";
System.out.println(str.trim()); // "Hello"
public class StringSpaces {
public static void main(String[] args) {
String str = " Hello World ";
str = str.trim();
System.out.println("String- " + str);
}
}