DO Character in String [with Index]
This Do command scans a string from the first through the last character. The iterator, Character, is a Local scalar integer variable. Unless previously declared it is implicitly declared as a Byte unless it's name is Byte, Parcel, Word, or Cell. In that case the implicit type corresponds to it's name.
In each iteration the iterator is assigned the next character in the string. When the iterator is wider than a byte the value is zero-extended. Upon exiting the loop the iterator will be set to the last character scanned. The loop may exit prematurely using the Undo command. If the source string is empty, the iterator will be unchanged.
The source string can be any String expression. If it is a simple variable it may not be modified within the loop. However, you can modify it by enclosing the source variable in parenthesis. This way it gets treated as an expression; causing the value to be copied to an internal temporary variable.
If a With clause is coded the Index variable counts the number of loops. Th Index corresponds to the position in the string of each character. It can be declared as a local variable with an integer type. If the Index variable has not already been declared it will be implicitly declared as a Word unless it's name is Byte, Parcel, or Cell. If so then the variable has the same type as its name. The Index variable and character iterator cannot have the same names. If the source string is empty the loop is skipped and the Index will be zero.
DO C in Text with I :Iterate over each character in text. DO C in Text ! Suffix :Iterate over a string expression. DO C in tail( Text, 3 ) :Iterate over the third through the end.