Wrox Home  
Search P2P Archive for: Go

  Return to Index  

aspx_beginners thread: Convert character to acsii


Message #1 by "John Hamman {Hamman Interactive}" <johnhamman@C...> on Mon, 24 Jun 2002 12:10:15 -0400
Hi all, I know that in vb.6 you would use ASC("a") to convert to acsii but
how do you do it in .net?
john

Message #2 by "David Adames" <david@p...> on Tue, 25 Jun 2002 02:07:36
> Hi all, I know that in vb.6 you would use ASC("a") to convert to acsii 
but
how do you do it in .net?
john

Per the VB.NET help...
Remarks
Asc returns the code point, or character code, for the input character. 
This can be 0 through 255 for single-byte character set (SBCS) values and -
32768 through 32767 for double-byte character set (DBCS) values. The 
returned value depends on the code page for the current thread, which is 
contained in the ANSICodePage property of the TextInfo class. 
TextInfo.ANSICodePage can be obtained by specifying 
System.Globalization.CultureInfo.CurrentCulture.TextInfo.ANSICodePage.

AscW returns the Unicode code point for the input character. This can be 0 
through 65535. The returned value is independent of the culture and code 
page settings for the current thread.

Example
This example uses the Asc function to return Integer character codes 
corresponding to the first letter in each string.

Dim MyInt As Integer
MyInt = Asc("A")   ' MyInt is set to 65.
MyInt = Asc("a")   ' MyInt is set to 97.
MyInt = Asc("Apple")   ' MyInt is set to 65.
See Also

  Return to Index