AW: AW: Lines, items, repeat loops, > not always what you think
Ken Ray
kray at sonsothunder.com
Thu Oct 20 18:06:39 EDT 2005
> function delimCount strr, del
> put the itemDelimiter into saveDelim
> set the itemDelimiter to del
> get the number of items in strr
> if the last char of strr is del then add 1 to it
> set the itemDelimiter to saveDelim
> return it
> end delimCount
This one is slightly faster, but is less lines:
function delimCount tStr,tDel
replace tDel with CR in tStr
return the number of lines of (tStr & null)
end delimCount
Also note that a modified form of this can be used to count any number of
characters in a string:
function charCount tStr,tChar
if tChar <> CR then replace CR with "" in tStr
replace tChar with CR in tStr
return the number of lines of (tStr & null)
end charCount
HTH,
Ken Ray
Sons of Thunder Software
Web site: http://www.sonsothunder.com/
Email: kray at sonsothunder.com
More information about the use-livecode
mailing list