Remove multple EXTRA spaces from string

2010-04-23 Thread UXB Internet

I am having a senior moment and can't for the life of me figure this dumb
thing out.  I am trying to remove all extra spaces from a string but leave
the single space there.  Example:
var=this has   many   extra  spaces and return with this has
many extra spaces




Dennis Powers
UXB Internet - A Website Design  Hosting Company
P.O. Box 6028
Wolcott, CT 06716
203-879-2844
http://www.uxbinternet.com







~|
Want to reach the ColdFusion community with something they want? Let them know 
on the House of Fusion mailing lists
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:333110
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: Remove multple EXTRA spaces from string

2010-04-23 Thread Leigh

 I am having a senior moment 
Space, the final frontier. These are the ... (Oh, that kind of space)

I am not a regex guru. But maybe this?
cfset newStr = reReplace(str, [ ]{2,},  , all)



  

~|
Want to reach the ColdFusion community with something they want? Let them know 
on the House of Fusion mailing lists
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:333111
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


RE: Remove multple EXTRA spaces from string

2010-04-23 Thread brad

This appears to work for me:

cfset string = rereplace(string,( +), ,all)


 Original Message 
Subject: Remove multple EXTRA spaces from string
From: UXB Internet denn...@uxbinternet.com
Date: Fri, April 23, 2010 3:26 pm
To: cf-talk cf-talk@houseoffusion.com


I am having a senior moment and can't for the life of me figure this
dumb
thing out. I am trying to remove all extra spaces from a string but
leave
the single space there. Example:
var=this has many extra spaces and return with this has
many extra spaces


~|
Want to reach the ColdFusion community with something they want? Let them know 
on the House of Fusion mailing lists
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:333112
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: Remove multple EXTRA spaces from string

2010-04-23 Thread Charlie Griefer

On Fri, Apr 23, 2010 at 1:26 PM, UXB Internet denn...@uxbinternet.comwrote:


 I am having a senior moment and can't for the life of me figure this dumb
 thing out.  I am trying to remove all extra spaces from a string but
 leave
 the single space there.  Example:
 var=this has   many   extra  spaces and return with this has
 many extra spaces


var myString = this has many extra   spaces;

myString = rereplace( myString , \s+ , ' ' , 'all' );

-- 
Charlie Griefer
http://charlie.griefer.com/

I have failed as much as I have succeeded. But I love my life. I love my
wife. And I wish you my kind of success.


~|
Want to reach the ColdFusion community with something they want? Let them know 
on the House of Fusion mailing lists
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:333113
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


RE: Remove multple EXTRA spaces from string

2010-04-23 Thread Leigh

 cfset string = rereplace(string,( +), ,all)

Knew there was a more elegant method I was forgetting..


  

~|
Want to reach the ColdFusion community with something they want? Let them know 
on the House of Fusion mailing lists
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:333114
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


RE: Remove multple EXTRA spaces from string

2010-04-23 Thread UXB Internet

 This appears to work for me:
 cfset string = rereplace(string,( +), ,all)


And for me as well. smile Thank you very much.  It has been a long week
today.


Dennis Powers
UXB Internet - A Website Design  Hosting Company
P.O. Box 6028
Wolcott, CT 06716
203-879-2844
http://www.uxbinternet.com





~|
Want to reach the ColdFusion community with something they want? Let them know 
on the House of Fusion mailing lists
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:333116
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm