Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

decimal to ascii

Status
Not open for further replies.

yytan

Programmer
May 8, 2002
113
MY
hi there;

i am current convert from hex to ascii using this syntax:
<b>
String cr = &quot;1b&quot;; // carriage return
char chrcr;

chrcr = (char) Integer.parseInt(cr,16);
</b>

may i know how to change from decimal to char straight away? is that possible? wat i mean the cr instead of putting hex value, i put decimal value which is &quot;27&quot;.

thanks in advance.
 
This doesn't really answer your question, but if you just need the carriage return, you can do this:
Code:
  String s = &quot;\n&quot;;

or

  char cr = '\n';
[\code]
 
If I remeber correctly you can simply set a char value equel to the number:

char break = 27;

It should also works the other way around so that

int c = 'c';

will show the ascii value for c
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top