1. ## convert to decimal

Hi friends,

i have a set of ascii data's i.e.,(cp437) format.. i want to convert these ascii values to decimal..
is this possible to convert.

String asciicp437 = "ÑΩ∞ód~" // (cp437 or IBM437)

am tried the normal concept but i didn't work..

here is my code
String asciicp437 = "ÑΩ∞ód~╣µÜ<";
for(..........)
{

char ch = asciicp437.charAt(i);
int a = (int)(ch);
String hex = Integer.toHexString(a);
system.out.println(hex);
}

any one can solve this

thanks and regards
jagan R

2. When you put your code in [code][/code] tags it's easier to read.

Also, use a Short, Self Contained, Correct Example so we can see what's actually going on with your code.

3. Originally Posted by rjagan
String hex = Integer.toHexString(a);
Please make up your mind: your topic title mentions a decimal representation of a char while your code converts an int to a hexadecimal representation; what do you want?

kind regards,

Jos

4. that's not a problem.. dec == hex == ascii == binary all are have the equvalant value.. i need any one of the conversion..

do u have the solution for this.. ??

5. Originally Posted by rjagan
that's not a problem.. dec == hex == ascii == binary all are have the equvalant value.. i need any one of the conversion..

do u have the solution for this.. ??
Maybe, but what "doesn't work" with your code? You have to be explicit about (the behaviour of) your code.

kind regards,

Jos

6. my code working finely.. but it converts the ascii value (cp437) to dec it shows the decimal value from cp1252 format (windows format)

i have the codepage437 ascii value.. to convert decimal

7. String asciicp437 = "ÑΩ∞ód~╣µÜ<";
What value, in what data type, do you expect to receive when you convert this?

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•