Re: Convert from int to char
- From: Patricia Shanahan <pats@xxxxxxx>
- Date: Mon, 25 Sep 2006 22:32:45 GMT
Mocha_Java wrote:
Okay, so i have a dilemma. I have a int variable called rank that
stores integers (obviously). however, i need to display these values as
chars in another method. casting dosent help because it just converts
the integer into the unicode character which isn't the same as the
number.
heres a snippet of the problem:
char r; // as you can see, its gets pretty
repetitive and boring
if (rank == 2)
r = '2';
if (rank == 3)
r = '3';
if (rank == 4)
r = '4';
....
return r;
is there a trick to make my int number the equivalent char number?
Does Character.forDigit() do what you want?
Patricia
.
- References:
- Convert from int to char
- From: Mocha_Java
- Convert from int to char
- Prev by Date: Re: How to drop this exception?
- Next by Date: Re: Convert from int to char
- Previous by thread: Convert from int to char
- Next by thread: Re: Convert from int to char
- Index(es):
Relevant Pages
|