StringField()
Posted: Fri Dec 15, 2006 8:25 am
				
				Some hours ago i have started a small program and i thought there was a bug somewhere in PB, because i had everytime wrong results and tried to cut down my code and try to find the problem. I must say, when ever i code a loop or count something, i will start at 0 and not at 1...
Now, after an extreme smoking head and trying to cut down my source more and more, i found the problem and i cant understand the reason that StringField() will start at position 1 instead at position 0 
 
To understand and see what i mean... here is a small example i did, before i noticed in the docs, that it will start at position 1 :roll:
			Now, after an extreme smoking head and trying to cut down my source more and more, i found the problem and i cant understand the reason that StringField() will start at position 1 instead at position 0
 
 To understand and see what i mean... here is a small example i did, before i noticed in the docs, that it will start at position 1 :roll:
Code: Select all
; 
; *************************************************************************************
; *
; *  Just try to split the sTxtRead.s string into seperate parts while using StringField()
; *  and save the results to our aTxt.s array! I dont know why, but it seems the first 
; *  string part of out sTxtRead.s will be read two times by using StringField() instead
; *  just only once.
; *
; *  Array:        Should be:        PB result is:  
; *  -------------------------------------------------
; *  aTxt.s(0)     --> part1         --> part1
; *  aTxt.s(1)     --> part2         --> part1
; *  aTxt.s(2)     trying            --> part2
; *  aTxt.s(3)     to                trying
; *  aTxt.s(4)     show              to
; *  aTxt.s(5)     the               show
; *  aTxt.s(6)     bug               the
; *  aTxt.s(7)                       bug      
; *                                        
; *************************************************************************************
Dim aTxt.s(8)
sTxtRead.s = "--> part1;-->part2;trying;to;show;the;bug"
  
For i = 0 To 7
  aTxt(i) = StringField(sTxtRead.s, i, ";")
  Debug aTxt(i)
Next