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

Jussi Lahtinen jussi.lahtinen at ...626...
Wed May 10 21:25:31 CEST 2017


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 <matti.eber at ...3240...> 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'.
>
> 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 <matti.eber at ...3240...> 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 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 <matti.eber at ...3240...>:
> >>>
> >>>> 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
> >>>>
> >>>>
> >>> ------------------------------------------------------------
> >> ------------------
> >>> 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
> >>>
> >> ------------------------------------------------------------
> >> ------------------
> >> 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
> >>
> > ------------------------------------------------------------
> ------------------
> > 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
>
> ------------------------------------------------------------
> ------------------
> 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