Mark Smith wrote:
On 16 Jun 2006, at 00:47, Jared Smith wrote:
Here are a few things that I've been confused about:
1) How do I find the number of times a certain character appears in a
string? The "offset" function only finds the first occurance, it
doesn't count them.
This function should work:
function charCount tText,tChar
set the itemDelimiter to tChar
return the number of items in tText - 1
end charCount
Watch out for the case where the last character in the string is the one
you are interested in; because there isn't an item after it, this gives
the wrong result - I'd use
function charCount tText,tChar
set the itemDelimiter to tChar
if char -1 of tText = tChar then
return the number of items in tText
else
return the number of items in tText - 1
end if
end charCount
--
Alex Tweedly http://www.tweedly.net
--
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.394 / Virus Database: 268.8.4/364 - Release Date: 14/06/2006
_______________________________________________
use-revolution mailing list
[email protected]
Please visit this url to subscribe, unsubscribe and manage your subscription
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution