saladsurgery
kicking the cack
something is freakin me out in the string manipulation section of sam davis's SDD text:
p 135, the second delete algo for strings
BEGIN Delete (Start,Finish,DeleteString)
Temp = DeleteString
Position = Start
Length = Finish - Start + 1
WHILE Position <= Finish
Temp(Position) = Temp (Position + Length)
Add 1 to Position
ENDWHILE
Reduce size of Temp by Length
Delete = Temp
END Delete
Can someone check this? I'm not sure, but...
If you delete part of a string that is shorter than the remaining part, then you get some sort of crazy duplication thing going on.
eg:
to delete "pha" from elephantitis"
p 135, the second delete algo for strings
BEGIN Delete (Start,Finish,DeleteString)
Temp = DeleteString
Position = Start
Length = Finish - Start + 1
WHILE Position <= Finish
Temp(Position) = Temp (Position + Length)
Add 1 to Position
ENDWHILE
Reduce size of Temp by Length
Delete = Temp
END Delete
Can someone check this? I'm not sure, but...
If you delete part of a string that is shorter than the remaining part, then you get some sort of crazy duplication thing going on.
eg:
to delete "pha" from elephantitis"
- "p" is replaced with "n" --> elenhantitis
- "h" is replaced with "t" --> elentantitis
- "a" is replaced with "i" --> elentintitis
- since Position is now > Finish, the loop exits and "tis" is cut off, so you get "elentinti" instead of "elentitis".
[/list=1]
confused...
---edit---
sam, i have seen you floating around these boards... any comments?
Last edited: