Reputation: 28503
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
Upvotes: 0
Views: 213
Reputation: 32905
var foundAt = listFind(searchString, updateArticle);
if (foundAt)
searchString = ListDeleteAt(searchString, foundAt);
Upvotes: 3
Reputation: 3546
The replace
function returns a value. You're currently using it as though you were doing a direct output.
<cfset fixedText = Replace(ToString(variables.searchString), ToString(variables.updateArticle), "")>
Upvotes: 1
Reputation: 31077
I haven't used coldfusion since cf8 came out but aren't you supposed to do:
<cfset variables.searchString = Replace(variables.searchString, variables.updateArticle, "")>
Upvotes: 1