for in Str



for..in String
Smart pascal source code
var c: Integer; var s: String; const cHello = 'Hello'; for c in cHello do WriteLn(Chr(c) + ': ' + IntToStr(c)); s := #$1D538#$3B1#$1D516; for c in s do WriteLn('unicode $' + UpperCase(IntToHex(c, 5))); var i: Integer; for i := Low(s) to High(s) do begin c := Ord(s[i]); WriteLn('ord $' + UpperCase(IntToHex(c, 5))); end; var trap := 'trap'; function TrapIt: String; begin Result := trap; trap := 'bug'; end; for c in TrapIt do WriteLn(Chr(c) + ': $' + UpperCase(IntToHex(c, 5))); {<<< RESULT - CONSOLE LOG >>> ----------------------------- H: 72 e: 101 l: 108 l: 108 o: 111 unicode $1D538 unicode $003B1 unicode $1D516 ord $0D835 ord $0DD38 ord $003B1 ord $0D835 ord $0DD16 t: $00074 r: $00072 a: $00061 p: $00070 ----------------------------- {<<<<<<<<< THE END >>>>>>>>>}