Thank you all for your help.
Now, my search is really fast.
For anyone having similar problems:
1. My source was a huge unsorted JSON file. I converted it to a much smaller
sorted text file. So, reading it into a String array, the array is already
sorted.
2. String[].Find() indeed works with Mod
On 05/10/2017 02:24 PM, Matti wrote:
> Oh yes, oh yes!
> Thank you, Jorge.
> I always thought, Value could also be part of a string.
It can be. Use the gb.Like comparison mode, ie:
String[].Find("Chr*", gb.Like)
See the Predefined Constants link at
http://gambaswiki.org/wiki/comp/gb/string[]/fi
Btw. that is not exactly heuristic approach (more like plain algorithmic),
because I don't know statistical properties of you array. IE what we can
assume. Now the index is always divided by two, but if you know how the
distribution of the data, you may make much more effective guesses
depending on
This works only for sorted array. Example you could take the maximum index
of your array, divide it by two and look which side of the array the
searched string could be.
Let's say you have array of 1000 elements and you are looking for "Chr". If
sMyArray[500] begins with "M", then you should look
Jussi, could you please explain?
Yes, I have to match the beginning of the string - but what means a "heuristic
guess for the index"?
Am 10.05.2017 um 21:25 schrieb Jussi Lahtinen:
> If you need to match only the beginning of the string, you could sort the
> array and then make heuristic guess fo
On Wed, 10 May 2017, Matti wrote:
> Yes. But as I don't know [iIndex], I have to iterate through the (huge) array
> with 'For...Next'.
> I hoped to make it faster with 'Find'.
You can make the code smaller by using the optional Mode parameter to
String[].Find() (cf. the docs [1]). The following w
If you need to match only the beginning of the string, you could sort the
array and then make heuristic guess for the index.
Jussi
On Wed, May 10, 2017 at 10:18 PM, Matti wrote:
> Yes. But as I don't know [iIndex], I have to iterate through the (huge)
> array with 'For...Next'.
> I hoped to ma
Yes. But as I don't know [iIndex], I have to iterate through the (huge) array
with 'For...Next'.
I hoped to make it faster with 'Find'.
Am 10.05.2017 um 20:59 schrieb Jussi Lahtinen:
> For that use; String.InStr(sYourArray[iIndex], "Chr")
>
>
> Jussi
>
>
> On Wed, May 10, 2017 at 9:24 PM, Matti
For that use; String.InStr(sYourArray[iIndex], "Chr")
Jussi
On Wed, May 10, 2017 at 9:24 PM, Matti wrote:
> Oh yes, oh yes!
> Thank you, Jorge.
> I always thought, Value could also be part of a string.
>
> Am 10.05.2017 um 19:08 schrieb Jorge Carrión:
> > Wiki says: "Returns the position of t
Oh yes, oh yes!
Thank you, Jorge.
I always thought, Value could also be part of a string.
Am 10.05.2017 um 19:08 schrieb Jorge Carrión:
> Wiki says: "Returns the position of the first occurrence of Value in the
> array."
> You must search for a Value of the array.
>
> In your array there isn't a V
Wiki says: "Returns the position of the first occurrence of Value in the
array."
You must search for a Value of the array.
In your array there isn't a Value "Chr", that is what you search, so always
returns -1
Best Regars
2017-05-10 18:57 GMT+02:00 Matti :
> I tried to search an array with the
11 matches
Mail list logo