Taking your suggestion I put this function together. My effort works in a
simple way, but it is not a total solution to my problem...
What I'm attempting to do is stitch together a number of different strings
to create a keyword list. After the strings are assembled I need to strip
out any duplicate words or phrases delimited by commas. Is there a way to do
this with having to specify the words/phrases to search for. RegExp's maybe?
Any suggestions?
-Doug
-----------------------
<cfscript>
function CleanKeywords(str){
str = ReReplaceNoCase(str,"^[^[:alnum:]]*", "");// trims space at front
str = rereplaceNoCase(str,"[^[:alnum:]]*$", "");// trims space at rear
str = ReplaceNoCase(str,"Word_1","1x1x1x1");// replace first occurance of
word with place holder word.
str = ReplaceNoCase(str,"Word_2","2x2x2x2");
str = ReplaceNoCase(str,"Word_3","3x3x3x3");
// add addional words to find.
str = ReplaceList(str,"Word_1,Word_2,Word_3",", , ,");// delete additional
occurances of word.
str = ReplaceNoCase(str,"1x1%1x1","Word_1");// restore original word at
place holder word.
str = ReplaceNoCase(str,"2x2%2x2","Word_2");
str = ReplaceNoCase(str,"3x3%3x3","Word_3");
// add addional words to restore.
return str;
}
</cfscript>
----- Original Message -----
From: "Claude Schneegans" <[EMAIL PROTECTED]>
To: "CF-Talk" <[EMAIL PROTECTED]>
Sent: Saturday, May 15, 2004 8:27 PM
Subject: Re: Strip multiple words from string
> Hmmmm, I think I would use the replace function to first replace the first
occurrence of the word by some string unlikely to be found in the text,
like say "%*%*%*", then replace all remaining words by nothing, using "all"
, then but back the word at the place %*%*%* is.
> If you don't have too many words, the solution is workable.
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

