Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Optimization on the Occurs() method
Message
De
10/08/2006 10:36:12
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
 
À
10/08/2006 10:33:30
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Versions des environnements
Environment:
VB 8.0
OS:
Windows XP SP2
Database:
Visual FoxPro
Divers
Thread ID:
01144405
Message ID:
01144519
Vues:
12
I don't know, I don't have the toolkit. I'd suggest almost the same code and saw yyour reply with code:)
Cetin

>>That'd return 4 where VFP occurs() would return 2. IOW the one in the toolkit continues search from found+1, not found+searchStrlen.
>
>Good catch Cetin ... looks like a bug in this VFP Toolkit method. I've never used it or tested it, so I just posted "as is" from the Toolkit Help. I only have an original version of the Toolkit ... I wonder if there's been bug-fixes or upgrades?
>
>~~Bonnie
>
>
>
>
>>>>You're "creating" strings inside your loop with this statement:
>>>>
>>>>                lcString = Mid(lcString, lnLocation + 2)
>>>>
>>>>This is where you would benefit from using StringBuilder.
>>>>
>>>>The example from the VFP Toolkit for .NET doesn't need StringBuilder because it doesn't do this.
>>>
>>>The first example loops thru all characters. So, if I am passing a 17k string, for example, that would mean it would process in the loop 17000 times. I like the second example as it uses a position to start on the next occurence. I will adjust for that one. I use StringBuilder on a lot of places. It is just that this one hasn't been optimized yet. I will do that now. Thanks
>>
>>Michel,
>>However be warned that function unlike its name suggests (and from VFP toolkit) is not one to one match VFP's occurs() behavior. It's arguable which one is correct (probably answer is depends). ie:
>>input string: aaaaa
>>search: aa
>>That'd return 4 where VFP occurs() would return 2. IOW the one in the toolkit continues search from found+1, not found+searchStrlen.
>>Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform