diese Prozedur dient lediglich dazu zwei StringFields auszutauschen:
Code: Alles auswählen
Procedure.s ExchangeStringFields(String.s, Index1, Index2, Separator.s)
If Index1 > Index2
c = Index1
Index1 = Index2
Index2 = c
EndIf
m1 = Index1
m2 = Index2
While m1 > 1
x1 = FindString(String, Separator, x1)+1
m1 - 1
Wend
While m2 > 1
x2 = FindString(String, Separator, x2)+1
m2 - 1
Wend
s1 = Len(StringField(String, Index1, Separator))
s2 = Len(StringField(String, Index2, Separator))
String2.s = Left(String, x1) + StringField(String, Index2, Separator) + Mid(String, x1+s1+1, x2-(x1+s1)-1) + StringField(String, Index1, Separator) + Right(String, Len(String)-(x2+s2-1))
ProcedureReturn String2
EndProcedure
;Hier ein Beispiel:
Debug ExchangeStringFields("Test1|Test12|Test123", 1, 2, "|")