[Gambas-user] .Find only from position "1"?

Rolf-Werner Eilert eilert-sprachen at ...221...
Mon Mar 14 16:12:56 CET 2016


Have just stumbled over this one.

To make things short, elements of an address have to be collected. This 
is the code snippet:

   feld = Split(felderKopieAdresse[lsKopieAdresse.Index], ",")

   For i = 0 To feld.Max
     If links.Find(feld[i]) > -1 Then
       adresse.Add(rechts[links.Find(feld[i])])
     End If
   Next

feld contains the names of the address fields, i. e. "Anr1", "Vorname1", 
"Name1" etc.

"links" is the pointer to the address contents in "rechts", i. e. if 
links[x] = "Anr1", its index points to "Herr" or "Frau" in rechts[x]

Now this runs well:

- feld will contain a collection of fields to be delivered, i. e. 
"Anr1", "Vorname1", "Name1" etc.
- it starts with 0

But on the first loop, Find will deliver -1

On later loops, it runs well. So the first element of the address is 
ignored.

I have checked all brackets and stuff, I have run it step-by-step, and 
each time I run it, but the first search item isn't found.

"Anr1" is in links[0], it is definitely there. It is also in feld[0]. 
And when i=0, links.Find(feld[i]) should find it and deliver "0", not -1.

I even tried with another list of search items: Same behaviour, the 
first loop doesn't find anything.

Am I blind???

Thanks for any help!

Rolf





More information about the User mailing list