[Gambas-user] String[].Find finds nothing

Matti matti.eber at ...3240...
Tue May 16 20:58:58 CEST 2017


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 Mode=gb.Like=4. It's faster than doing the For...Next work yourself.
3. But gb.Like doesn't mean it finds anything matching your first characters, case insensitive. You have to use 'i = MyStringArray.Find(SearchString & "*", gb.Like, 0).

Regards, Matti

Am 10.05.2017 um 18:57 schrieb Matti:
> I tried to search an array with the 'Find' function instead of 'For...Next' and 'InStr'.
>
> The wiki says:
> "String[].Find (gb)
> Function Find ( Value As String [ , Mode As Integer, Start As Integer ] ) As Integer
> Returns the position of the first occurrence of Value in the array.
> If Value cannot be found, -1 is returned."
>
> But I can do what I want, I always get '-1'. No positive result ever.
>
> Attached is a tiny project that should show this behaviour.
> Where is my mistake?
> Thanks in advance
> Matti
>
> Gambas 3.9.2
>
>
> ------------------------------------------------------------------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
>
>
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user




More information about the User mailing list