Search code examples
stringcoldfusionreplacecoldfusion-8

How can I remove a string/number from a list of numbers in Coldfusion?


Only stupid problems today... (still running coldfusion8)

I'm still messing with my list of strings. Now I need to remove 1 number out of the list...:

<cfdump output="e:\dump.txt" label="catch" var="--- drop ---">
<cfdump output="e:\dump.txt" label="catch" var="#ToString(variables.searchString)#">
<cfdump output="e:\dump.txt" label="catch" var="#ToString(variables.updateArticle)#">

<cfset Replace(ToString(variables.searchString), ToString(variables.updateArticle), "")>

<cfdump output="e:\dump.txt" label="catch" var="--- drop ----">
<cfdump output="e:\dump.txt" label="catch" var="#variables.searchString#">

My dump shows the following:

--- drop ---- 
596925,596864,596871 
596925
---- done ----
596925,596864,596871  

Question:
Any idea, why this is not working? ToString already is a desperation attempt...

Thanks


Solution

  • I haven't used coldfusion since cf8 came out but aren't you supposed to do:

    <cfset variables.searchString = Replace(variables.searchString, variables.updateArticle, "")>