Monday, February 22, 2010

Replace in CF

Replaces occurrences of substring1 in a string with substring2, in a specified scope. The search is case-sensitive.

Syntax:
Replace(string, substring1, substring2 [, scope ])

Parameter Description
string String in which to search
substring1 String for which to search
substring2 String that replaces substring1
scope one: replace the first occurrence (default)
all: replace all occurrences


To remove a string, specify the empty string ("") as substring2.
You do not need to escape comma characters in strings.

Program:
#Replace(FORM.myString, FORM.MySubstring1, FORM.mySubString2)#

Source: http://livedocs.adobe.com/coldfusion/6.1/htmldocs/functa68.htm#wp1111342

No comments:

Computers Add to Technorati Favorites Programming Blogs - BlogCatalog Blog Directory