tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Parsons Technical Services" <parsonstechni...@earthlink.net>
Subject Re: off topic - how do i convert an int to char
Date Tue, 07 Dec 2004 16:10:39 GMT
Cast it with the offset added.
int i = 0;
char ch = (char)(i+97);

Wrap in a try catch block if desired.

Doug

----- Original Message ----- 
From: "Nilesh Bhattad" <nilesh@outlinesys.com>
To: "Tomcat Users List" <tomcat-user@jakarta.apache.org>; "Yang Xiao" 
<yxiao2004@gmail.com>
Sent: Tuesday, December 07, 2004 10:51 AM
Subject: Re: off topic - how do i convert an int to char


> That would be the last solution if i dont get any other better way of 
> doing it... i tried with Character.forDigit(97, 2) hoping to get 'a' back 
> but it returned 0... i'm not sure which radix does it expect as a 2nd 
> argument.
>
> btw Yang, thanks for quick response.
>
> - nilesh
>
> ----- Original Message ----- 
> From: "Yang Xiao" <yxiao2004@gmail.com>
> To: "Tomcat Users List" <tomcat-user@jakarta.apache.org>
> Sent: Tuesday, December 07, 2004 10:42 AM
> Subject: Re: off topic - how do i convert an int to char
>
>
>> make a hash or array?
>>
>>
>> On Tue, 7 Dec 2004 10:34:15 -0500, Nilesh Bhattad <nilesh@outlinesys.com> 
>> wrote:
>>> folks,
>>> sorry for posting this offtopic qns here.. but would someone plz help me 
>>> out in converting an int value to char? my requirement is very simple. 
>>> i'm looping thro a list and for each counter i need to get 'a', 'b' and 
>>> so forth.
>>>
>>> basically i need some conversion routine which will convert 0 to 'a', 1 
>>> to 'b', 2 to 'c' and so on.
>>>
>>> again, i apologize for posting such a dumb qns.
>>>
>>> - nilesh
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>>
>>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>
>
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Mime
View raw message