/t5/coldfusion-discussions/count-number-of-instances-of-a-text-string/td-p/53221Oct 23, 2006
Oct 23, 2006
Copy link to clipboard
Copied
This should be easy to do, right? I'm not finding it in my
function list. I have find and refind, but maybe there is a
function or custom tag that will return the number of instances of
a given substring within a larger text string?
Sorry if I am blanking on something terribly obvious.
/t5/coldfusion-discussions/count-number-of-instances-of-a-text-string/m-p/53222#M5565Oct 23, 2006
Oct 23, 2006
Copy link to clipboard
Copied
First do a Replace( ) function, replacing the substring with
a character that is guaranteed not to be in your string (like a
pipe (|)). Then do a ListLen, using that character as the list
delimiter.
/t5/coldfusion-discussions/count-number-of-instances-of-a-text-string/m-p/53223#M5566Oct 24, 2006
Oct 24, 2006
Copy link to clipboard
Copied
No CF function, but you can roll your own. I used
REFindNoCase in mine, by you could easily make "case-ness" an
optional parameter to the function or just use the Finds instead.