Trim(String) will get rid of leading or trailing spaces. You may need a RegEx and use ReReplace() if you want to replace multiple connsecutive spaces with just a single dash though. RegEx is not my bag, so I can't help with specifics.
On 10/18/07, Steve Sequenzia wrote: > > I need to take a string and replace all the spaces with dashes. I tried > using the replace function but I am having issues with strings that have > multiple spaces next to each other and/or a space or spaces at the end. Here > is what I have: > > <cfset dirName = #Replace(String," ", "-", "ALL")#> > > Any suggestions on a better way to do this? > > Thanks in advance for any help. > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Get the answers you are looking for on the ColdFusion Labs Forum direct from active programmers and developers. http://www.adobe.com/cfusion/webforums/forum/categories.cfm?forumid-72&catid=648 Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:291466 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

