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
make a hash or array?
On Tue, 7 Dec 2004 10:34:15 -0500, Nilesh Bhattad [EMAIL PROTECTED] 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
Users List
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
[EMAIL PROTECTED]
wrote:
folks,
sorry for posting this offtopic qns here.. but would someone plz
help me
out in converting an int value to char
-
From: Yang Xiao [EMAIL PROTECTED]
To: Tomcat Users List [EMAIL PROTECTED]
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 [EMAIL PROTECTED]
wrote:
folks,
sorry
Wow, was I off.
Add a 97 to your int value to get the lower-case English letters.
B.
-Original Message-
From: Brantley Hobbs
Sent: Tuesday, December 07, 2004 10:50 AM
To: Tomcat Users List; Yang Xiao
Subject: RE: off topic - how do i convert an int to char
Alternatively, you can
From: Nilesh Bhattad [mailto:[EMAIL PROTECTED]
Subject: Re: off topic - how do i convert an int to char
Oh, come on.
String letterAt(int i) {
return abcdefghijklmnopqrstuvwxyz.substring(i, i + 1);
}
Fast, portable, simple.
- Peter
Thanks!!!
that worked !!
- Original Message -
From: Brantley Hobbs [EMAIL PROTECTED]
To: Tomcat Users List [EMAIL PROTECTED]; Yang Xiao
[EMAIL PROTECTED]
Sent: Tuesday, December 07, 2004 10:54 AM
Subject: RE: off topic - how do i convert an int to char
Wow, was I off.
Add a 97 to your
Users List; Yang Xiao
Subject: RE: off topic - how do i convert an int to char
Alternatively, you can add the ASCII offset to the integer, then get the
char that evaluates to that ASCII code. I think its 32, but you'll need
to check for sure.
B.
-Original Message-
From
11:01 AM
To: Brantley Hobbs; Yang Xiao
Cc: Tomcat Users List
Subject: Re: off topic - how do i convert an int to char
Thanks!!!
that worked !!
- Original Message -
From: Brantley Hobbs [EMAIL PROTECTED]
To: Tomcat Users List [EMAIL PROTECTED]; Yang Xiao
[EMAIL PROTECTED]
Sent
: 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
am I being silly?
char ch = (char)myint;
Filip
- Original Message -
From: Robert Harper [EMAIL PROTECTED]
To: 'Tomcat Users List' [EMAIL PROTECTED]
Sent: Tuesday, December 07, 2004 10:01 AM
Subject: RE: off topic - how do i convert an int to char
The offset starts at '0' == 48 ( 0x30
From: Parsons Technical Services [mailto:[EMAIL PROTECTED]
Subject: Re: off topic - how do i convert an int to char
Cast it with the offset added.
int i = 0;
char ch = (char)(i+97);
Or if you want to make it a little more understandable:
char ch = (char) (i + 'a');
Note
- how do i convert an int to char
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
13 matches
Mail list logo