Thursday, May 19, 2005

Deleting A Character Using replace()

I am having a problem replacing a string occurance with "". In efect I want to remove chr(13) characters from a string but the below code gives the error: Argument 2 of function Replace cannot be an empty value.

My Code: var sStringNew = replace(pMemoString,"",chr(13),"ALL");

Arguments 2 and 3 are transposed. The search string comes first, then the replacement string.
var sStringNew = replace(pMemoString,Chr(13),"","ALL")

Also, if you're looking to just strip out Chr(13), you can use the StripCR function.
<cfset sStringNew=StripCR(pMemoString)>

0 Comments:

Post a Comment

<< Home