[thelist] Cold Fusion and string manipulation

Jeff jeff at members.evolt.org
Wed, 19 Jan 2000 12:30:11 -0800


frank,

:~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
: From: Frank <framar@interlog.com>
:
: Let's say (all other considerations aside) that I wanted to replace
: all <li> with say <image> <p class="">. Piece of cake.
:~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

assuming the string that contains the stuff you want to replace is held in
the variable "yourstring" and you wanted the search and replace to be
case-insensitive:

#ReplaceNoCase(yourstring,'<li>','<image> <p class="">','ALL')#

or, if you wanted this to be a case sensitive search and replace:

#Replace(yourstring,'<li>','<image> <p class="">','ALL')#

:~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
: I've been looking for such things in Cold Fusion. I
: notice that it's phenomenal at database manipulation,
: but doesn't seem so strong on strings.
:~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

it's actually got tons of string manipulation functions.  you just gotta
look for 'em.  *grin*

:~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
: Another example would be that I could replace all
: incidents of "Abc Corp." with "ABC INC." either in
: the template, or in the body just as processed.
:~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

assuming a case-sensitive replace and the string you want to process is held
in the variable "pagecontent":

#Replace(pagecontent,'Abc Corp.','ABC INC.','ALL')#

:~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
: Another example would be to find/replace all
: incidents of "ABC" with "XYZ" in the database
: itself. I'm finding this to be lacking in Cold Fusion
:~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

#Replace(pagecontent,'ABC','XYZ','ALL')#

you can find all sorts of info on string manipulation in the cold fusion
documentation with your server install, usually somewhere like this:

http://127.0.0.1/cfdocs/CFML_Language_Reference/3_ColdFusion_Functions/lr3_0
13.htm

good luck,

: jeff.howden
: web.development.professional
: evolt.org.member
:
: the.best.looking.developers.on.the.net
:
: http://evolt.org/
: jeff@members.evolt.org