Strings
0
:
myString := "abcde"; Print(myString[1]); $b myString[1] := $x; Print(myString); "axcde"Although you can use array syntax with strings, strings are not arrays. Sadly, the
foreach
loop does not work. You will need to revert to an old-style for
loop to iterate through the elements of a string:
for i := 0 to StrLen(s) - 1 do begin // do something to s[i] end
An online version of Programming for the Newton using Macintosh, 2nd ed. ©1996, 1994, Julie McKeehan and Neil Rhodes.
Last modified: 1 DEC 1996