473,385 Members | 1,730 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Equivalent of String.fromCharCode() method in C#

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
Nov 16 '05 #1
2 21354
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.

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com
"Bob" <an*******@discussions.microsoft.com> wrote in message
news:93****************************@phx.gbl...
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

Nov 16 '05 #2

"Bob" <an*******@discussions.microsoft.com> wrote in message
news:93****************************@phx.gbl...
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
Nov 16 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Steve | last post by:
Hi, I am trying to do a very simple "encryption" of a text string in java script. For instance, if the user enters : steve, I want to just convert each character to its ASCII value and add 5...
1
by: Erinys | last post by:
Hi, I need to access the individual bytes in a string in my javascript function. If the characters in the string were all ascii characters then there would not be a problem, however in my case...
5
by: ken | last post by:
hello, i'm using charCodeAt to get the ascii value at a given location in a string but now i want to set the value of a location in a string to a specific ascii value. is there a way to do this?...
7
by: Julia | last post by:
Hi I am trying to pass an encoded string to a JavaScript the following is the C# code which convert the string STRING_TO_ENCODE to base64 byte bytIn =...
9
by: Alan Silver | last post by:
Hello, I'm converting some old VB6 code to use with ASP.NET and have come unstuck with the Asc() function. This was used in the old VB6 code to convert a character to its ASCII numeric...
3
by: Pugi! | last post by:
I got this (piece of) script from 'DHTML Utopia - Modern Webdesign - Using Javascript & DOM'. function aKeyWasPressed(e) { if (window.event) { var key = window.event.keyCode; } else { var key...
10
by: ja | last post by:
hi, i have problems with converting entities to chars, i'm using function: function entityToString (htmlString){ htmlString = htmlString.replace(/(&)(#)(\d{1,})(;)/g, function...
3
by: John Nagle | last post by:
I have XML replies in a DOM which contain entity escapes, like "&amp;". What's the proper way to replace them with the ordinary characters? Preferably something that will work in most browsers? I...
20
by: Xcriber51 | last post by:
Hi -- I'm not entirely familiar with the norms and standard libraries of JavaScript so if the answer to this is yesterday's news, please ignore. I'm trying to write a simple text formatting...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.