mestnyi wrote:Maybe there was no need to write here, but I think it is somehow connected.![]()
Can you help me speed up the process?
On macos I could not adapt your options.![]()
Code: Select all
EnableExplicit
Procedure StringFields (String$, List Fields$(), Separator$)
;BESCHREIBUNG: Zerlegt String$ in Teilstrings, welche durch Separator$ getrennt sind und
; stellt diese in die List Fields$.
;PARAMETER : String$ = Der zu durchsuchende String
; Fields$() = List in die die Teilstrings gestellt werden
; Separator$ = Trennzeichen (auch mehrere Zeichen)
;RÜCKGABEWERT: keiner
;¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
Structure CHARARRAY : c.c[0] : EndStructure
Protected *Sta.CHARARRAY
Protected *End.CHARARRAY
Protected *Sep.CHARARRAY
Protected LenSeparator
Protected IsMatched
Protected i
#SOC = SizeOf (Character)
*Sta = @String$
*End = @String$
*Sep = @Separator$
LenSeparator = Len (Separator$)
;Single Sign Separator
If LenSeparator = 1
While *End\c
If *End\c = *Sep\c
AddElement (Fields$())
Fields$() = PeekS (*Sta, (*End-*Sta)/#SOC)
*Sta = *End + #SOC
EndIf
*End + #SOC
Wend
AddElement (Fields$())
Fields$() = PeekS (*Sta, (*End-*Sta)/#SOC)
;Multi Sign Separator
Else
While *End\c
IsMatched = #True
For i = 0 To LenSeparator - 1
If *End\c[i] <> *Sep\c[i]
IsMatched = #False
Break
EndIf
Next
If IsMatched
AddElement (Fields$())
Fields$() = PeekS (*Sta, (*End-*Sta)/#SOC)
*Sta = *End + LenSeparator * #SOC
*End + LenSeparator * #SOC
Else
*End + #SOC
EndIf
Wend
AddElement (Fields$())
Fields$() = PeekS (*Sta, (*End-*Sta)/#SOC)
EndIf
EndProcedure
Global Text.s, String.s, a,f,f1,l,time.i, c.s = #LF$, LN.i=50000
Global NewList String.s()
Global *Buffer = AllocateMemory(LN*100)
Global *Pointer = *Buffer
time = ElapsedMilliseconds()
For a = 0 To LN
Text.s = "Item "+Str(a) + c
CopyMemoryString(PeekS(@Text), @*Pointer) ; 3
Next
Text = PeekS(*Buffer)
Text.s = Trim(Text.s, c)
Debug Str(ElapsedMilliseconds()-time) + " text collection time"
time = ElapsedMilliseconds()
StringFields (Text, String(), c)
Debug Str(ElapsedMilliseconds()-time) + " text parse time "
Debug "all count "+ListSize(String())