CountFieldsMBS(text as string, delimiter as string) as integer
For a text with delimiters like "Only;a;test;string" with 4 words and the semicolon as delimiter, this function can count the number of words between delimiters. If text is empty, the result is zero. If delimiter is empty, the result is 1. For the example string above the result is 4.
This function can be used to count the number of times a substring is inside a bigger string if you take the result and subtract one. CountFieldsMBS("Only;a;test;string", ";")-1 is 3 as we have three semicolon.
This function is optimized for UTF8 and UTF16.
select CountFieldsMBS("Hello;World",";") select CountFieldsMBS("a b c"," ")
Back to function list.
MBS Xojo blog