Many of us misses the old days when a character was represented by a single byte. These days we need to worry about codepages, character translations, and the works... Well Unicode chars came to our rescue and saved us from having to worry about all these stuff. But, sometimes we need to represent a string as an array of bytes. The .NET Framework provides several encoding mechanisms: ASCII, UTF7, UTF8, Unicode. Did you notice something missing? The good old ANSI. ANSI, to those who don't know it, is a super set of ASCII each char is represented by a single byte (range 0-255). ANSI Encoding is system dependent, but extremly efficient when handling with strings. The class I'm providing fill this gap. It provides a fast way to convert from a string to an array of ANSI bytes. Each char in the string (or char array) is converted to byte through Microsoft.VisualBasic.Asc function. So, I think it will be easy to understand. It's multi threaded in order to acheive performance. In my tests I was able to convert an string about 1,000,000 chars long in less than 3 senconds. *UPDATE* Fixed a little bug when handling strings and/ou byte arrays that was multiple of 256 in length. Added a Project Sample (along with a new status bar control)
File List:
@PSC_ReadMe_3317_10.txt
2Kb
ANSIEncoding.sln
1Kb
ANSIEncoding.vbproj
4Kb
AssemblyInfo.vb
1Kb
Encoding.vb
15Kb
Sample/
0b
Sample/AssemblyInfo.vb
1Kb
Sample/ProgressStatusBar.resx
6Kb
Sample/ProgressStatusBar.vb
4Kb
Sample/Sample.gif
26Kb
Sample/Sample.vbproj
5Kb
Sample/frmAboutBox.resx
23Kb
Sample/frmAboutBox.vb
47Kb
Sample/frmBinaryData.resx
18Kb
Sample/frmBinaryData.vb
13Kb
Similar code
Html2VB
(Popularity: ) : Are you tired from manually encode html in vb code? It may happen that you want to insert a piece of html in your VB code for some purposes (making a parser, a mailto link, a html page, etc...), and ... Advanced Installer Serial File Parser
(Popularity: ) : This handy little app will parse serial code files created by Advanced Installer from Caphyon. Email finder & Email validator
(Popularity: ) : With these two functions, you can find all the emails in a string and validates these emails. The function are : FindEmail ValidEmail Function FindEmail let you find ALL the email in one text. To be found, the email must ... English/Arabic Number-To-Text Class
(Popularity: ) : Here is a very useful class: NumberToText. The class accepts a whole number (maximum 15 digits) and translates it into English/Arabic text. For example, the integer 145 is converted into "one hunderd forty five" in English.
I've used his code for ... Word Guess/String builder stuff
(Popularity: ) : I made this for someone in the VB .NET forums. It opens a list of words, puts a random word into a text box, and there's another text box for guessing the word. As you get it correct, it replaces ...