The 's' replaces 1 space match at any given time even so the 's+' replaces the whole Place sequence simultaneously with the 2nd parameter. On the other hand x.replaceAll("\s+", ""); is going to be a lot more effective technique for trimming spaces (if string might have several contiguous Areas) due https://mantra-nootropic-bar43186.popup-blog.com/30719119/about-s