How to get rid of all white space in a string such phone code example Example: how to remove all whitespace from string java st = st.replaceAll("\\s+","")