Smart pascal source code
var i: Integer;
var s: String := '1';
var v: Variant;
IntToStr(i);
StrToInt(s);
StrToFloat(s);
VarToStr(v);
s := 'z';
try
StrToInt(s);
except
on e: Exception do
WriteLn(e.Message.Replace(" '' ", " '")); end;
try StrToFloat(s); except on e:Exception do WriteLn(e.Message); end;
i := -1; try Chr(i); except on e:Exception do WriteLn(e.Message); end;
{<<< RESULT - CONSOLE LOG >>>
-----------------------------
'z' is not a valid integer value [line: 13, column: 4]
'z' is not a valid floating point value [line: 19, column: 4]
Invalid codepoint: -1 [line: 26, column: 4]
-----------------------------
{<<<<<<<<< THE END >>>>>>>>>}
function Chr(c) {
if (c<=0xFFFF)
return String.fromCharCode(c);
c-=0x10000;
return String.fromCharCode(0xD800+(c>>10))+String.fromCharCode(0xDC00+(c&0x3FF));
}
function $Check(i,z) { if (i) return i; throw Exception.Create($New(Exception),"Object not instantiated"+z); }
function VarToStr(v) { return (typeof v === "undefined")?"":v.toString() }
s = "1";
i.toString();
parseInt(s,10);
parseFloat(s);
VarToStr(v);
s = "z";
try {
parseInt(s,10);
} catch ($e) {
var e = $W($e);
WriteLn(StrReplace($Check(e,"").FMessage," '' "," '")) }
try {
parseFloat(s);
} catch ($e) {
var e$1 = $W($e);
WriteLn($Check(e$1,"").FMessage) }
i = -1;
try {
Chr(i);
} catch ($e) {
var e$2 = $W($e);
WriteLn($Check(e$2,"").FMessage) }