Yeah, string parsing by character is one of the things that VFP sucks at royally! Use of substring to go through a string character by character is useless unless strings are really, really short.
THis tends to be one place where I often call out to C code (or API calls) to perform a specific task to improve perf drasticly.
+++ Rick ---
>>Hey all
>>
>>It's easy enough to take a string and reverse it...
>>
>>
LPARAMETERS m.tcString
>>LOCAL m.lnI, m.lcTemp
>>m.lcTemp = ""
>>FOR m.lnI = LEN(m.tcString) TO 1 STEP -1
>> m.lcTemp = m.lcTemp + SUBSTR(m.tcString,m.lnI,1)
>>ENDFOR m.lnI
>>RETURN m.lcTemp
>>
>>But I would like a faster way.
>>
>>Given a 128 Bit (16 Byte) GUID, how can it be reversed except for that?
>>
>>I played with CTOBIN(BINTOC()) but while I'm getting close, it's just not exact.
>>
>>Starting with this GUID, 009A946C98F7DC1181E3000D56EC5F75, I'd like to see it become 755FEC560D00E38111DCF7986C949A00
>>
>>Thanks
>___________________
>Mike,
>
>The fastest I have found (for null terminated strings)
>//
http://msdn2.microsoft.com/en-us/library/9hby7w40(VS.71).aspx>
>
>The first time it is called it will do the declare. The other times it will just do the api directly
>
>The execution time on my computer (vfp9sp2) in a loop (i = 1 to 1000000) is 14 sec for your function compared to 1.8 for StringReverse()
>
>
>function StringReverse(s)
>
> declare string _strrev in msvcrt.dll as StringReverse string
>
> return StringReverse(m.s)
>endfunc
>