Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the difference between Asc() and AscW()?

Tags:

vb.net

What is the difference between Asc and AscW in vb.net? I have similar question about Chr() and ChrW() functions too! Is there any benefits for using them with or without W suffix?!

like image 463
Mojtaba Rezaeian Avatar asked Nov 04 '25 11:11

Mojtaba Rezaeian


1 Answers

Unicode is a standard that is designed to replace the ANSI standard for encoding characters in a numeric form. Because the ANSI standard only uses a single byte to represent each character, it is limited to a maximum of 256 different characters. While this is sufficient for the needs of an English speaking audience, it falls short when the worldwide software market is considered. With the Unicode standard, each character is represented by two bytes, so that the entire Unicode character set includes 65,536 possible locations.

Microsoft Windows NT, Microsoft Windows 2000, and Microsoft OLE 2.0 are entirely Unicode based, and Visual Basic (4.0 and higher) represents all strings internally in Unicode format. The AscW and ChrW functions allow access to the full range of Unicode characters. These functions work in the same way as the original Asc and Chr functions except that they support arguments from 0 to 65,535 instead of just from 0 to 255. Many Visual Basic objects (such as the debug window and the label and text box) return a "?" when these objects do not know how to display an Unicode character.

Please read more here about this (it's the official article from Microsoft; their link is now dead)

like image 92
Trevor Avatar answered Nov 06 '25 02:11

Trevor



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!