Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Locating and replacing a charcter in a field
Message
From
28/12/1999 15:23:49
 
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00309380
Message ID:
00309430
Views:
26
>Actually, I believe that Dave Frankenbach found this not to be the case recently; the time on STRTRAN() was ~O(n) whereas CHRTRAN() ~O(n^2) on performing substitutions.

Hmm, well in the context of Sean's example:
clear

s = seconds()
for x = 1 to 1000000
	=strtran('smith, charles', ',', '')
endfor
?seconds() - s

s = seconds()
for x = 1 to 1000000
	=chrtran('smith, charles', ',', '')
endfor
?seconds() - s
I always get nearly a third the time. But this is with one occurence and one character, so you are probably correct (whats new? :-), but in Seans question, CHRTran() would be a better faster choice.
Previous
Reply
Map
View

Click here to load this message in the networking platform