Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Extract a Word
Message
From
12/07/2001 08:54:13
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivia
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Miscellaneous
Thread ID:
00529297
Message ID:
00529629
Views:
12
>alines() is simpler and, if you believe the Microsoft documentation, should be faster...

That is a big "if"... However, you are right. I believed it would take alines() too long to copy the text into the array, but the following test program confirms that alines() is, indeed, faster that mline(), even when using the variable _mline.
clear

lcString = ""
for i = 1 to 1000
	lcString = lcString + chr(13) + chr(10) + alltrim(str(i))
next

* mline()
lnStart = seconds()
for i = 1 to memlines(lcString)
	discard(mline(lcString, i))
next
? "mline():", seconds() - lnStart

* mline() + _mline
lnStart = seconds()
_mline = 0
for i = 1 to memlines(lcString)
	discard(mline(lcString, 1, _mline))
next
? "mline() + _mline:", seconds() - lnStart

* alines()
lnStart = seconds()
for i = 1 to alines(MyArray, lcString)
	discard(MyArray(i))
next
? "alines():", seconds() - lnStart

FUNCTION Discard(lcString)
return .T.
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform