Substr bug in loop behaviour
Chris Fitsimons
Member Posts: 135
Interesting problem and a possible bug. I have the code and result in attached screen shot.
- loop from 1 to 20
- debug.log substr(var,counter,1)
- 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
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).
Contact me for custom work - Expert GS developer with 15 years of GS experience - Skype: armelline.support