how to get rid of whitespacce in a string code example Example: java 8 remove spaces from string a.replaceAll("\\s+","");