The function doesn't look correct. This should work (I modified it, but didn't test)
function WordInstance(word,string){
var i = 0;
var start = 1;
var exit = false;
var tmp = "";
var special_char_list = "\,+,*,?,.,[,],^,$,(,),{,},|,-";
var esc_special_char_list = "\\,\+,\*,\?,\.,\[,\],\^,\$,\(,\),\{,\},\|,\-";
word = ReplaceList(word, special_char_list, esc_special_char_list);
string = " " & string & " ";
while(NOT exit){
tmp=REFindNoCase("[^a-z]+#word#[^a-z]+",string,start,true);
if(tmp.pos[0] gt 0){
i=i+1;
start=tmp.pos[0]+tmp.len[0];
}else{
exit = true;
}
}
return i;
}
Pascal
-----Oorspronkelijk bericht-----
Van: Ketan Patel [mailto:[EMAIL PROTECTED]
Verzonden: vr 17/10/2003 13:42
Aan: CF-Talk
CC:
Onderwerp: RE: number of occurrences in a string.
Does anybody have answer for this .When I use cflib function wordinstance()
sometimes CPU usage will max out ,it reaches its max to 100%. It takes a
good amount of time to open the page. This is the only function which give
me correct results. My concern is when the site will generate good traffic
it will choke the server. I am not sure why. Any help or suggestions are
appreciated.
[Todays Threads]
[This Message]
[Subscription]
[Fast Unsubscribe]
[User Settings]
- RE: number of occurrences in a string. Ketan Patel
- RE: number of occurrences in a string. Tim Blair
- RE: number of occurrences in a string. Tim Blair
- RE: number of occurrences in a string. Ketan Patel
- RE: number of occurrences in a string. Robyn Follen
- RE: number of occurrences in a string. Raymond Camden
- RE: number of occurrences in a string. Bryan F. Hogan
- RE: number of occurrences in a string. Tim Blair
- RE: number of occurrences in a string. Pascal Peters
- RE: number of occurrences in a string. Tim Blair
- RE: number of occurrences in a string. Pascal Peters
- RE: number of occurrences in a string. Raymond Camden
- RE: number of occurrences in a string. Pascal Peters
- RE: number of occurrences in a string. Pascal Peters
- RE: number of occurrences in a string. Raymond Camden
- RE: number of occurrences in a string. Raymond Camden
- RE: number of occurrences in a string. Philip Arnold
- RE: number of occurrences in a string. Raymond Camden
- RE: number of occurrences in a string. Barney Boisvert
- RE: number of occurrences in a string. Pascal Peters