Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
CHRTRAN and remove characters
Message
From
14/10/2004 06:14:33
Walter Meester
HoogkarspelNetherlands
 
 
To
14/10/2004 04:00:15
General information
Forum:
Visual FoxPro
Category:
Visual FoxPro Beta
Miscellaneous
Thread ID:
00950654
Message ID:
00951316
Views:
6
Fabio and Gregory,

I think you miss the point of david here. His algortithm is only moving the characters that are in the result and they're moved only once. His algorithm is (more or less) equivalent to the following VFP code
FUNCTION DeQoute (cString)
LOCAL nPointer

nPointer = 0
FOR nT = 1 TO LEN(cString)
    cChar = SUBSTR(cString, nT, 1)
    IF cChar != '"'
        nPointer = nPointer + 1
        cString = STUFF(cString, nPointer, 1, cChar)
    ENDIF
ENDFOR

cString = SUBSTR(cString,1, nPointer)
RETURN LEN(cString)
Each character is only handled once. Honestly I really don't see any advantage to approach this problem from a right to left strategy here.

The difference with the current implementation of CHRTRAN is that when a iterating through the characters in the string, it is going to move all remaining characters 1 position back whenever a character needs to be deleted. This results in the performance issue posibly a huge number of characters have moved multiple times in one CHARTRAN call. This is certainly not the case in davids algorithm.

Walter,
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform