Even still if your looping over a list and the list items contain the same
char as what's being used as the list delimiter then its not going to solve
anything looping over it, which is why I said in my post 

////////////////////
now if your list items actually have commas or what ever your using as the
delimiter in them, then you will have to either use a different delimiter or
deal with the list items prior to creating or inserting them into the list
string
///////////////////

Now listReplace does not let you define a delimiter char, so I wouldn't look
at using listReplace until you can be certain that your list is correctly
demilited.

So, when your creating your list, use another char as a delimiter instead of
a comma, then convert the exsiting commas into something else, like a pipe
(|) or something, convert your list delimiters into commas, do your
listReplace(), and then convert your, foe example, pipes (|) back into
commas for your final string.

I know its tedious but not a lot else you can do

With your example #ReplaceList(var," ,/,,","_,_,_")# you could try something
like this

#ReplaceList(replace(var," ,/,,"," ~/~~","ALL")," ~/~~","_,_,_"))#

See how you go

Regards,
Steve Onnis

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Adam Cameron
Sent: Wednesday, June 30, 2004 2:25 PM
To: CFAussie Mailing List
Subject: [cfaussie] Re: replace comma

Is it just me, or are people answering the wrong question?

The original poster wishes to perform some sort of transformation like
this:

String:
The people coming to the party are Tom, Dick, and Harry; they're going
to be wearing blue, red and yellow (respectively).  Tom, Dick and Harry
have been mates for several years, and every time I've seen them,
they've been wearing blue, red and yellow.

And they want to change all instances of "Tom, Dick, and Harry" and
"blue, red and yellow" to read "Groucho, Chico, Harpo, as well as Zeppo
and Gummo" and "red, white, blue, green and gold", respectively.

End result:
The people coming to the party are Groucho, Chico, Harpo, as well as
Zeppo and Gummo; they're going to be wearing red, white, blue, green and
gold (respectively).  Groucho, Chico, Harpo, as well as Zeppo and Gummo
have been mates for several years, and every time I've seen them,
they've been wearing red, white, blue, green and gold.

(yeah, it's a crap example ;-)


And replaceList() works like this:

newString = replaceList(oldString, list1, list2)

And this is where we fall over... The DATA in list1 and list2 contains
commas.  We'd have something like this:


newString = replaceList(oldString, "Tom, Dick, and Harry, blue, red and
yellow", "Groucho, Chico, Harpo, as well as Zeppo and Gummo, red, white,
blue, green and gold");

Note that we cannot tell which is the list delimiter, and what is data
in this example.  And replaceLits() will not accept an alternate
delmiter.  Hence the problem.

I'm guessing the easiest solution is to not attempt it in one hit, but
to loop over each item to replace, doing thems sequentially.

I've mentioned this on the MM beta forums... Let's see what happens with
it...



Adam Cameron
Senior Application Developer
Straker Interactive

Ph: +64 9 3605034
Fx: +64 9 3605870
Email: [EMAIL PROTECTED]



-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Steve
Onnis
Sent: Wednesday, 30 June 2004 4:12 p.m.
To: CFAussie Mailing List
Subject: [cfaussie] Re: replace comma


There are list functions to do this stuff

listChangeDelims(list,  new_delimiter ,  delimiters )


now if your list items actually have commas or what ever your using as
the delimiter in them, then you will have to either use a different
delimiter or deal with the list items prior to creating or inserting
them into the list string

Steve



-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Brett
Payne-Rhodes
Sent: Wednesday, June 30, 2004 1:54 PM
To: CFAussie Mailing List
Subject: [cfaussie] Re: replace comma

Hi Alistair,

Just put the comma between the quotes and it should work fine. I haven't

used 'replaceList' but it works in 'replace':

<cfset theString = "a,b,c,d">
<cfset theString = replace(theString, ",", ";", "all")>

<cfoutput>#theString#</cfoutput>

should result in a;b;c;d

I assume it will be ok in replaceList.

hth

Brett
B)

Alistair Fox wrote:
> Does anyone now how to replace a , in a list with something else. CF 
> us the comma as a delimeter in the replacelist function. So how do i 
> replace a , when it interprets it as another delimeter 
> #ReplaceList(var," ,/,,","_,_,_")#
> 
> ---
> You are currently subscribed to cfaussie as: [EMAIL PROTECTED] To 
> unsubscribe send a blank email to
[EMAIL PROTECTED]
> Aussie Macromedia Developers: http://lists.daemon.com.au/
> 


-- 
Brett Payne-Rhodes
Eaglehawk Computing
t: +61 (0)8 9371-0471
f: +61 (0)8 9371-0470
m: +61 (0)414 371 047
e: [EMAIL PROTECTED]
w: www.ehc.net.au


---
You are currently subscribed to cfaussie as: [EMAIL PROTECTED]
To unsubscribe send a blank email to
[EMAIL PROTECTED]
Aussie Macromedia Developers: http://lists.daemon.com.au/



---
You are currently subscribed to cfaussie as: [EMAIL PROTECTED] To
unsubscribe send a blank email to
[EMAIL PROTECTED]
Aussie Macromedia Developers: http://lists.daemon.com.au/

---
You are currently subscribed to cfaussie as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED]
Aussie Macromedia Developers: http://lists.daemon.com.au/



---
You are currently subscribed to cfaussie as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED]
Aussie Macromedia Developers: http://lists.daemon.com.au/

Reply via email to