x BlueRobot Administrator Staff member Joined May 7, 2013 Posts 10,265 Location %systemroot% Aug 5, 2013 #1 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. Click to expand... View attachment ASCII Converter V2.zip
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. Click to expand... View attachment ASCII Converter V2.zip
AceInfinity Emeritus, Contributor Joined Feb 21, 2012 Posts 1,728 Location Canada Aug 7, 2013 #2 Just as a mention, this was far beyond what was needed in order to achieve this kind of functionality: Code: 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... 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: Aug 7, 2013
Just as a mention, this was far beyond what was needed in order to achieve this kind of functionality: Code: 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... 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.