Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > I Can't Count

I Can't Count
Thread Tools
davidboring
Guest
Status:
Reply With Quote
Apr 24, 2000, 11:46 AM
 
Is their anyway to count the number of occurrences of a string within another string? I tried using the count command but I get the error 'Access not allowed'. And I tried using Akua Sweets 'collect items of --that match' command but I couldn't get it to work.

Thanks in advance for any help.
     
Dedicated MacNNer
Join Date: Nov 1999
Location: Georgetown, Demerara, Guyana
Status: Offline
Reply With Quote
Apr 24, 2000, 03:57 PM
 
Hi:

Try one of the regular-expression parser OSAXen available via ScriptWeb's Osaxen scripting-additions library or the AppleScript Sourcebook's Scripting Additions, Add-Ons & Plug-Ins links page.

For example, Leonard Rosenthol's RegEx Commands OSAX lets you do something like this:-
Code:
set matchResult to (REMatch {"abcabcabcabcabc"} pattern "abc" using "*" separator "." with ignoreCase) -- returns '{*.*.*.*.*}' set numMatches to ((count matchResult) - ((count matchResult) div 2)) -- returns 5
Regards,

--Paul
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 11:02 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2