Code-Beispiel
Umfangreiche Split-String Routine für Variable Arrayfelder
Lizenz: | Erster Autor: | Letzte Bearbeitung: |
k. A. | ThePuppetMaster | 18.10.2007 |
Declare sub F_SplitString(V_Data as string, B_DD() as string, byref B_DC as long, V_CutString as string, V_ClearArray as byte, V_Casesensitivity as Byte, V_AddEmpty as Byte)
Dim X as long
Dim dd() as string
Dim dc as long
print "Eingabe: "; command(0); " "; command
print "---------"
F_SplitString Command, dd(), dc, " ", 1, 0, 1
print "Count:"; dc
for x = 1 to dc
print dc; " >"; dd(x); "<"
next
sub F_SplitString(V_Data as string, B_DD() as string, byref B_DC as long, V_CutString as string, V_ClearArray as byte, V_Casesensitivity as Byte, V_AddEmpty as Byte)
if V_ClearArray = 1 then b_dc = 0
redim preserve b_dd(b_dc) as string
Dim X as long
Dim Pos1 as long
Dim Pos2 as long
Dim SLen as long
Dim T as string
Dim S as string
Dim XOK as byte
s = v_cutstring
if V_Casesensitivity = 0 then s = lcase(v_cutstring)
SLen = len(s)
pos1 = 1
pos2 = 1
for x = 1 to len(v_data) - slen
if V_Casesensitivity = 0 then
if lcase(mid(v_data,x,slen)) = s then
t = mid(v_data,pos1,x-pos1+slen-1)
x+= slen-1
pos1 = x+1
endif
else
if mid(v_data,x,slen) = v_cutstring then
t = mid(v_data,pos1,x-pos1+slen-1)
x+= slen
pos1 = x
endif
endif
if pos1 <> pos2 or x = len(v_data) - slen then
if pos1 = pos2 then t = mid(v_data,pos1)
xok = 1
if t = "" then if v_addempty = 0 then xok = 0
if xok = 1 then
b_dc+= 1
redim preserve b_dd(b_dc) as string
b_dd(b_dc) = t
endif
pos2 = pos1
endif
next
end sub
Zusätzliche Informationen und Funktionen | |||||||
---|---|---|---|---|---|---|---|
|
|