New topic: Weird Count
<http://forums.realsoftware.com/viewtopic.php?t=30647> Page 1 of 1 [ 3 posts ] Previous topic | Next topic Author Message rlinsurf Post subject: Weird CountPosted: Sun Oct 25, 2009 2:12 am Joined: Tue Mar 21, 2006 12:49 am Posts: 36 I'm now able to count the number of times in the document that the string "_jottID" occurs, by using: Code:s=stream.ReadAll() counter="_jottId"""+" value=""" count=CountFields(s, counter) However, I did a manual count of the string in BBEdit in the same .txt, and it comes up with 20, the same as I counted by hand. But RB says the count is 21. Can someone explain that? Here's the original -- maybe I'm just missing something...? http://dhnet.us/test/3il.txt Just do a find in your browser for the string -- you'll see what I mean. Top Blake Post subject: Re: Weird CountPosted: Sun Oct 25, 2009 2:41 am Joined: Fri Sep 30, 2005 8:39 pm Posts: 206 Location: Arlington, TX Thats because you are searching for the string in BBedit, in RB you are counting how many items the string would be split into if you used the parameter as a separator Example: The quick brown fox jumps over the lazy dog Countfields( " " ) = 9 - This would split the sentence into 9 different words or 'fields' Search for " " = 8, space occurs 8 times in the sentence. If you want to know how many times it occurs in the file use CountFields() - 1. Top rlinsurf Post subject: Re: Weird CountPosted: Sun Oct 25, 2009 3:21 am Joined: Tue Mar 21, 2006 12:49 am Posts: 36 Ah. I knew it was probably something like that. Thanks Top Display posts from previous: All posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost timeSubject AscendingDescending Page 1 of 1 [ 3 posts ] -- Over 1500 classes with 29000 functions in one REALbasic plug-in collection. The Monkeybread Software Realbasic Plugin v9.3. http://www.monkeybreadsoftware.de/realbasic/plugins.shtml [email protected]
