On 10/20/05 5:06 PM, "Ken Ray" <[EMAIL PROTECTED]> wrote:

>> 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

Whoops! My bad... it should be this:

function delimCount tStr,tDel
  replace tDel with CR in tStr
  return (the number of lines of (tStr & null))-1
end delimCount

and

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))-1
end charCount

Sorry!

Ken Ray
Sons of Thunder Software
Web site: http://www.sonsothunder.com/
Email: [EMAIL PROTECTED]

_______________________________________________
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution

Reply via email to