I found the reason: There is a white space starting the string with the fieldnames, i. e. the first element begins with " ".
In the Gambas IDE (list with array contents) a whitespace is hardly visible. Maybe it would be an idea to indicate it by replacing it with another, unique character like a small middle-dot or coloring it with light gray, blue or so? Anyway, my problem is solved, and sorry for the noise :) Regards Rolf Am 14.03.2016 16:12, schrieb Rolf-Werner Eilert: > 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 > > > ------------------------------------------------------------------------------ > Transform Data into Opportunity. > Accelerate data analysis in your applications with > Intel Data Analytics Acceleration Library. > Click to learn more. > http://pubads.g.doubleclick.net/gampad/clk?id=278785231&iu=/4140 > _______________________________________________ > Gambas-user mailing list > Gambas-user@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/gambas-user > ------------------------------------------------------------------------------ Transform Data into Opportunity. Accelerate data analysis in your applications with Intel Data Analytics Acceleration Library. Click to learn more. http://pubads.g.doubleclick.net/gampad/clk?id=278785231&iu=/4140 _______________________________________________ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user