Hi!
Casting a char to int (goal: “A” becomes 65) works.
But how can I simply cast an int to a String, in JS? (goal:65 should become “A”)
Thanks!
Hi!
Casting a char to int (goal: “A” becomes 65) works.
But how can I simply cast an int to a String, in JS? (goal:65 should become “A”)
Thanks!
Just like this:
var a : char = 65;
In case anyone’s in a similar use case, here’s some code to convert a list of enum (here Notes) to a string and back. I use it to send a list as an RPC parameter.
function NotesToString(notes:List.<Notes>)
{
var noteString : String = "";
var noteChar : char;
for(note in notes)
{
noteChar = parseInt(note);
noteString+=noteChar;
}
return(noteString);
}
function StringToNotes(str : String)
{
var notes = List.<Notes>(str.length);
var noteInt : int;
var note : Notes;
for(s in str)
{
noteInt = s;
note = noteInt;
notes.Add(note);
}
return notes;
}