Reputation: 103
i need to adapt a pascal script into JavaScript. I was able to translate nearly all the code except this two functions.
Pascal codelines:
Result:= AnsiChar(b + ord('0'));
s:= AnsiString(copy(ReNr, 1, length(ReNr) - 1));`
The code in the AnsiChar()-function i already adapt with '0'.codePointAt(0) % 10
, and the code in the AnsiString() with ReNr.substr(1, ReNr.length - 1)
. But i don't understand what the Pascal Ansi-functions does.
Is there a JavaScript pendant to Pascals AnsiChar()
and AnsiString()
functions or what i have to do, to get the same effect in JavaScript?
Upvotes: 0
Views: 114
Reputation: 23
I belive it will be something like this:
Result = String.fromCharCode(b + '0'.charCodeAt(0) );
S = ReNr.substring(0, ReNr.length - 2);
Delphi's AnsiChar() creates a character from a given ASCII code.
AnsiString converts string to Ansi encoding if it was in multibyte.
Upvotes: 0