The 's' replaces a single space match at any given time nevertheless the 's+' replaces the whole Place sequence at the same time with the 2nd parameter. On the other hand x.replaceAll("\s+", ""); might be a lot more effective technique for trimming spaces (if string might have several contiguous Areas) https://mantra-euphoria-gummies87530.bloggactivo.com/30781325/new-step-by-step-map-for-s