Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SQL Select VFP vs SQL Server
Message
From
17/09/2014 09:21:28
Mike Yearwood
Toronto, Ontario, Canada
 
 
To
17/09/2014 02:50:42
General information
Forum:
Visual FoxPro
Category:
Other
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows Server 2012
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Web
Miscellaneous
Thread ID:
01607580
Message ID:
01607717
Views:
68
>>>>That is another reason I always concatenate the comma without any conditional checks and then delete the one trailing comma afterward. Firing a conditional check for each loop is not efficient in the long run.
>>>>
>>>>for x = 1 to 10
>>>> lcString = m.lnString + "a" + ","
>>>>endfor
>>>>lcString = left(m.lcString,len(m.lcString)-1)
>>>
>>>The code that leaves the trailing comma is not mine. But I am sure I will find the places where I need to "clean up" and the problem will be resolved.
>>>Thank you
>>
>>I did not say it was. Just offering a single way to do this simple job. I often wonder why this cannot be done one way by everyone.
>
>because edge cases might lurk. Loops with uncertain (read: no unrolling in code) but very low loop count but very heavy len(m.lcString) at loop end come to mind. Or separation is not done with "," but char depending on circumstances, possibly more than a sinngle char.

Not so. This is a very simple thing I posted above. In such a simple case, the other cases would be handled differently. You'd need strings bigger than 100 chars before len would be slower and then for all the people who say m. is not important, the differences are not important enough to suggest that doing the conditional check in the loop is better most of the time.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform