The call goes like this:
splitOver( massive_string, !" \r\n !?.,:;", array )
The result should be an array of strings carved over each character in the delimiter string. The function should eat all the delimiters. Any takers?
Code: Select all
Sub SplitOver ( byref txt as string, byref delim as string, outArr() as string )
txt &= chr(delim[0])
dim as integer nFields=0, bgn=0, lentxt = len(txt)-1, lendelim = len(delim)-1, nxt10k=0
dim as string newstring = ""
redim outArr(10000)
outArr(0) = txt
for i as integer = 0 to lentxt
for ii as integer = 0 to lendelim
if txt[i] = delim[ii] OR i = lentxt then
newstring = RIGHT ( LEFT ( txt, i ), i-bgn )
if newstring <> "" then
nFields+=1
nxt10k += 1
if nxt10k = 10000 then
redim preserve outArr(nFields+10000)
nxt10k = 0
end if
outArr(nFields) = newstring
endif
bgn = i+1
endif
next
next
redim preserve outArr( nFields )
end sub