The key is to first call trim to remove any leading and trailing spaces, and then call replaceAll to convert one or more blank spaces to a single space.
The code I show is a simple adaptation of the Java code I found on SO.
Collection
[
|
...
]
The key is to first call trim to remove any leading and trailing spaces, and then call replaceAll to convert one or more blank spaces to a single space.
The code I show is a simple adaptation of the Java code I found on SO.