Try using String.replaceAll(), e.g., String x = "hello world"; String y = x.replaceAll(" +", " ");
-ed On 7/22/05, klute <[EMAIL PROTECTED]> wrote: > hello all, > > my appologies for the OT. before i write this little > util, is there such thing already present out there? I > need to do something like: > MyStringUtil.trimSubsequentOccurrences(String input, > String pattern) > > Example: > > MyStringUtil.trimSubsequentOccurrences("it's a good > day", " ") <- not multiple spaces between some of the > words. and the output of the method will be "it's a > good day" (no multiple subsequent spaces). > > Best, > James > > > > ____________________________________________________ > Start your day with Yahoo! - make it your home page > http://www.yahoo.com/r/hs > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]