[C#] ASCII File Converter

x BlueRobot

Administrator
Staff member
Joined
May 7, 2013
Posts
10,400
The program allows you convert any uppercase and lowercase character to it's Decimal ASCII representation, as well as, convert any number (0-9) and special character (apart from \ since it kept thinking I was entering a newline character), such as ? to it's Decimal ASCII representation.

In case, your wondering why the program is at Version 2, it's because I originally posted a half completed DOS version on SevenForums and named it Beta. The changes between the two versions are, as follows:

  • Added GUI
  • Added support for lowercase characters, special characters and numbers.

UI.JPG

UI#2.JPG

View attachment ASCII Converter V2.zip
 
Just as a mention, this was far beyond what was needed in order to achieve this kind of functionality:
Code:
[PLAIN]switch (char.Parse(this.upperCase.Text))
      {
        case 'A':
          this.upperCaseDEC.Text = "65";
          break;
        case 'B':
          this.upperCaseDEC.Text = "66";
          break;
        case 'C':
          this.upperCaseDEC.Text = "67";
          break;
        case 'D':
          this.upperCaseDEC.Text = "68";

etc...
[/PLAIN]

You can do conversions directly:
Code:
char c = 'A';
int x = (int)c;

And for the "\" issue, all you needed was to double up on that character to escape itself. There's also the string verbatim. But as soon as you mentioned having this issue with the "\" character, I knew you were doing something perhaps not very efficient in your code... As that wouldn't happen with user input into a textbox for instance.
 
Last edited:

Has Sysnative Forums helped you? Please consider donating to help us support the site!

Back
Top