Substr bug in loop behaviour

Interesting problem and a possible bug. I have the code and result in attached screen shot.

  1. loop from 1 to 20
  2. debug.log substr(var,counter,1)
  3. counter=counter+1


This should show each character in the string from left to right but it stops. So 'abcdef' would show 'a' and stop.

If I were to debug.log substr(var,counter,20), it does show as exptected. So 'abcd..', 'bcd...', 'cd...' etc.


Am I missing something here or do we have a bug?

Comments

  • ArmellineArmelline Member, PRO Posts: 5,397

    You're showing the character from counter to 1. So from 1 to 1. Then from 2 to 1. Then from 3 to 1. So only the first sub string is valid. You want textSubStr(variable,counter,counter).

Sign In or Register to comment.