try this: <cfset string = rereplace(rereplace(string, ",+$", ""), ",+", ",", "all")>
Azadi On 02/11/2010 20:34 , Richard White wrote: > Hi, i need to replace all repeating commas in a string with only one comma, > plus remove the trailing comma, have tried a few different routes > unsuccessfully and would appreciate any input: > > for example i would the the string: 'Genns,,Dr,,,,Bish Stratford,,,' > to become: 'Genns,Dr,Bish Stratford' > > thanks > > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:338751 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm