The 's' replaces 1 space match at a time although the 's+' replaces The entire space sequence directly with the second parameter. Nonetheless x.replaceAll("\s+", ""); will probably be extra successful means of trimming Areas (if string can have various contiguous spaces) because of doubtless much less no of replacements thanks https://tysonxpdth.blogofoto.com/62620467/the-single-best-strategy-to-use-for-s