Equivalent of String.fromCharCode() method in C#

  • Thread starter Thread starter Bob
  • Start date Start date
B

Bob

In Jscript, fromCharCode returns a string from a number of
Unicode character values.
In the following example, test contains the string "plain":

var test = String.fromCharCode(112, 108, 97, 105, 110);

Does anyone know the equivalent of this method in J#?

To understand the JScrip example, save the following as a
html file and open that file

<html>
<head>
<script language="jscript">

function test() {

alert(String.fromCharCode(112, 108, 97, 105, 110));

}
</script>

<body onload="test()">

<p id=writebefore>
</P>

</body>
</html>


Thanks,
Bob
 
Bob,

I would create an array of characters with those values. Once you do
that you can pass the character array to the constructor of the string class
and it will give you a string.

Hope this helps.
 
Bob said:
In Jscript, fromCharCode returns a string from a number of
Unicode character values.
In the following example, test contains the string "plain":

var test = String.fromCharCode(112, 108, 97, 105, 110);

Does anyone know the equivalent of this method in J#?

String s = new String(new char[] {112,108,97,110});

David
 
Back
Top