> 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 that the previously suggested use of the substring() method has two
drawbacks: it returns a String, not a char as originally requested; and it
creates a new String object every time it's called. Both problems would be
avoided by using charAt() rather than substring(). Still not as fast as the
straight arithmetic shown above.
- Chuck
THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
MATERIAL and is thus for use only by the intended recipient. If you received
this in error, please contact the sender and delete the e-mail and its
attachments from all computers.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]