The 's' replaces a single space match at a time however the 's+' replaces The entire space sequence without delay with the second parameter. Even so x.replaceAll("\s+", ""); is going to be a lot more effective technique for trimming spaces (if string might have several contiguous Areas) due to the https://troymhzpg.theblogfairy.com/30755749/the-best-side-of-s