Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Search for number characters in a string
Message
From
06/05/2016 06:50:50
 
 
To
05/05/2016 13:03:58
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01635853
Message ID:
01635919
Views:
72
>>>I recommend using ALINES() to break your string up and then ASCAN() to search. I think it's much cleaner and suspect it will be much faster.
>>
>>
>>Long time ago (FPW times, 486/P I cpus) I moved a ASCAN-logic to string searching similar to Naomis approach in a large opimization task - string search back then was much faster than ASCAN and a testwise implemented binary search (done in .prg, not in a .fll) on a sorted array. No idea if newer runtimes and current cpu architecture change that...
>
>I haven't tested this particular question. For sure, ALINES() is way faster for parsing a string than anything else. (Here's my most recent article on the subject: http://www.tomorrowssolutionsllc.com/Articles/Breaking%20Up%20is%20Not%20Hard%20to%20Do.pdf.) But it's possible that searching the result could outweigh that advantage.
>
Also it is unclear if the numbered string is read from outside the program or built internally. The # of numbers (aka searches on a particular string) is also unknown - for a single search string search is probably unbeatable, the more searches are done on 1 string it is probable that a faster search (either indexseek after filling a cursor or vartype after addproperty()ing will offset the single setup/teardown cost to build the searchable structure. Low 3 digits of searches could do that ;-)
Previous
Reply
Map
View

Click here to load this message in the networking platform