for..in String ex2



for..in String
Smart pascal source code
var c, s: String; const cHello = 'Hello'; for c in cHello do WriteLn(c + ': ' + IntToStr(Ord(c))); s := #$1D538'A'#$3B1#$1D516; for c in s do WriteLn('unicode $' + UpperCase(IntToHex(Ord(c), 5)) + ' len ' + IntToStr(Length(c))); var trap := 'trap'; function TrapIt: String; begin Result := trap; trap := 'bug'; end; for c in TrapIt do WriteLn(c + ': $' + UpperCase(IntToHex(Ord(c), 5))); {<<< RESULT - CONSOLE LOG >>> ----------------------------- H: 72 e: 101 l: 108 l: 108 o: 111 unicode $1D538 len 2 unicode $00041 len 1 unicode $003B1 len 1 unicode $1D516 len 2 t: $00074 r: $00072 a: $00061 p: $00070 ----------------------------- {<<<<<<<<< THE END >>>>>>>>>}