473,401 Members | 2,125 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,401 software developers and data experts.

help in program

26
hello i'm doing a hex to ascii converter. but now the problem is whenever it's converted, the hex code would be in front of the ASCII code.

private void convertButton_Click(object sender, EventArgs e)
{
asciiTextBox.Text = HexString2Ascii(hexTextBox.Text);
}

Input: 4153434949
Output: 4153434949ASCII



i know the problem lies with the hexTextBox.Text. but how do i remove the 4153434949 in front of the converted one?
Oct 17 '08 #1
9 1401
Banfa
9,065 Expert Mod 8TB
What is the definition of the function HexString2Ascii?
Oct 17 '08 #2
trixxy
26
What is the definition of the function HexString2Ascii?
Expand|Select|Wrap|Line Numbers
  1. private string HexString2Ascii(string HexString)
  2.         {
  3.             StringBuilder Sb = new StringBuilder(hexTextBox.Text);
  4.             for (int intI = 0; intI <= hexTextBox.Text.Length - 2; intI += 2)
  5.             {
  6.                 Sb.Append(Convert.ToString(Convert.ToChar(Int32.Parse(HexString.Substring(intI, 2), System.Globalization.NumberStyles.HexNumber))));
  7.             }
  8.             return Sb.ToString();
  9.         }
Oct 17 '08 #3
Banfa
9,065 Expert Mod 8TB
Can you explain the purpose of line 3?
Oct 17 '08 #4
trixxy
26
Can you explain the purpose of line 3?
changes the text into a string.
Oct 17 '08 #5
newb16
687 512MB
Looks like java to me.
Oct 17 '08 #6
trixxy
26
Looks like java to me.
yeah c# is like java. object oriented.
Oct 17 '08 #7
JosAH
11,448 Expert 8TB
Looks like java to me.
I think it is C# and indeed the original text is stored in that StringBuilder first and
next the ASCII characters are appended do it. Line #3 should instantiate an
empty StringBuilder instead.

kind regards,

Jos
Oct 17 '08 #8
trixxy
26
I think it is C# and indeed the original text is stored in that StringBuilder first and
next the ASCII characters are appended do it. Line #3 should instantiate an
empty StringBuilder instead.

kind regards,

Jos
AH. thanks a whole lot dude. that made the trick.
Oct 17 '08 #9
JosAH
11,448 Expert 8TB
AH. thanks a whole lot dude. that made the trick.
You're welcome but next time make sure you post your C# questions in the .NET forum.
This is a C and C++ forum and has (almost) nothing to do with C# (nor Java).

kind regards,

Jos (moderator)
Oct 17 '08 #10

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: PHPkemon | last post by:
Hi there, A few weeks ago I made a post and got an answer which seemed very logical. Here's part of the post: PHPkemon wrote: > I think I've figured out how to do the main things like...
6
by: wukexin | last post by:
Help me, good men. I find mang books that introduce bit "mang header files",they talk too bit,in fact it is my too fool, I don't learn it, I have do a test program, but I have no correct doing...
5
by: Bec | last post by:
I'm in desperate need of your help.. I need to build an access database and have NO idea how to do this.. Not even where to start.. It IS for school, and am not asking anyone to do my...
7
by: tyler_durden | last post by:
thanks a lot for all your help..I'm really appreciated... with all the help I've been getting in forums I've been able to continue my program and it's almost done, but I'm having a big problem that...
2
by: Erik | last post by:
Hi Everyone, I'm having real problems compiling some source for eVC4++. The errors I am getting are below: It all seems to be centred around winsock. If I move the afsock.h reference to before...
2
by: Bsnpr8 | last post by:
I need help guys, i have to many stuff to do, because i am in my last 2 weeks of the university, my last assignment is to do a spell checker in C++, i have an idea but nothing is coming out. I really...
6
by: HelpME | last post by:
I wrote a program in Vb.Net that was running fine. However I am unable to install it on a couple of machines. When i run it I get a windows error message that says My Project.exe has...
1
by: ligong.yang | last post by:
Hi all, I got tortured by a very weird problem when I was using k. wilder's random generator class in my program. PS: wilder's generator class can be found at...
1
by: ligong.yang | last post by:
Hi all, I got tortured by a very weird problem when I was using k. wilder's random generator class in my program. PS: wilder's generator class can be found at...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.