Re: [Gambas-user] What's faster: RegExp or String function

2011-12-01 Thread Rolf-Werner Eilert
This one is ideal for my current project. In my eyes, it is very elegant. > > i=Instr(s,"<") > while i> 0 > j=InStr(s,">", i) > cut out from s the substring from i to j > i=Instr(s,"<") > wend I made a function out of it and cut the strings with String.Left and String.Mid, just

Re: [Gambas-user] What's faster: RegExp or String function

2011-11-30 Thread Jussi Lahtinen
Why don't you run benchmarks to find out? Dim ff As Float Dim ii As Integer ff = Timer For ii = 1 To SomeNumber FunctionToTest() Next Print "Time to run: " & CStr(Timer - ff) Choose value for "SomeNumber" so that run time is significant enough to give reasonably reliable measurement, in o

[Gambas-user] What's faster: RegExp or String function

2011-11-30 Thread Phạm Quang Dương
Hi all, I want to remove all substring marked with '<>'. I have 2 functions: Dim rEx As New Regexp rEx.Compile("<.*>") rEx.Exec(s) While rEx.Offset >= 0 s = Replace(s, rEx.Text, "") rEx.Exec(s) Wend And i=Instr(s,"<") while i > 0 j=InStr(s,">", i) cut out from s the substring f