Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the C # character ASCII code?

2025-01-20 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly explains "what is the ASCII code of the C # character". The content of the explanation in the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "what is the ASCII code of the C# character".

C # character ASCII code

In many cases, we need to get the ASCII code of an English character, or the Unicode code of a Chinese character, or query the coding of which character it is from the relevant code. Many people, especially those who switch to C # from VB programs, will complain about why there are no off-the-shelf functions in C # to do this-- because there are Asc () and Chr () functions in VB for this kind of conversion.

But if you have learned C, you will know that we only need to convert English character data into appropriate numerical data to get the corresponding C # character ASCII code; on the contrary, if an appropriate numerical data is forced to convert into character data, we can get the corresponding characters.

The range of characters in C # has been expanded to include not only single-byte characters, but also double-byte characters, such as Chinese characters. On the other hand, the conversion between characters and encodings still uses the practice of the C language-forced conversion. Consider the following example

Private void TestChar () {

Char ch = 'a'; short ii = 65

This.textBox1.Text = ""

This.textBox1.AppendText ("The ASCII code of\'"

+ ch + "\'is:" + (short) ch + "\ n")

This.textBox1.AppendText ("ASCII is" + ii.ToString () +

The char is: "+ (char) ii +"\ n ")

Char cn = 'medium'; short uc = 22478

This.textBox1.AppendText ("The Unicode of\'" + cn + "\'is:

"+ (short) cn +"\ n ")

This.textBox1.AppendText ("Unicode is" + uc.ToString () +

The char is: "+ (char) uc +"\ n ")

}

The result of its operation is

The ASCII code of'a'is: 97 ASCII is 65, the char is: A The Unicode of'is: 20013 Unicode is 22478, the char is: city

From this example, we can clearly understand that through forced conversion, we can encode the characters, or get the encoded characters. If you do not need short type coding, you can get int and other types of coding values.

Thank you for your reading, the above is the content of "what is the C # character ASCII code". After the study of this article, I believe you have a deeper understanding of what the C # character ASCII code is, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report