var padChar : char = "0"[0];
var scoreText : String = score.ToString().PadLeft(8, padChar)
Surely there has to be a better way of assigning a char in jscript?
var padChar : char = "0"[0];
var scoreText : String = score.ToString().PadLeft(8, padChar)
Surely there has to be a better way of assigning a char in jscript?
Im doing:
var scoreText = (score+"").PadLeft(8, "0"[0]);
which is essentially the same thing as you, so I would love to know.
In boo you can use char(“0”) and I guess you can do the same in JS too.
Maybe str.ToChar() or str.Chars(0) work too.
None of those work.
“x”[0] is faster to type than any of those anyway…
–Eric
Surely there is, yet, there isn’t…
/me stands a distance from the group, waving a C# syntax guidebook
“Come on… You know you want it…” ![]()
No, we don’t…the one or two advantages hardly outweigh the many annoyances. ![]()
–Eric
As a C++ developer in my day job I would much prefer to use C# but I just find that jscript is more ‘seamless’ (especially when working with the Vector classes).
That said the current project I am working on I am starting to be annoyed by the limitations of jscript. I am having to use workarounds because it does not support the abstract keyword (so no virtual inheritance) and the “x”[0] syntax for specifying a character is annoying (‘x’ would be much nicer).
Boo should be a good choice if you like JS’s simplicity, but still want C#'s power.