Article View: borland.public.jbuilder.java.language
Article #15728Re: what class can convert "int" to ASCII?
From: Steve Horsley
Date: Tue, 04 May 1999 00:00
Date: Tue, 04 May 1999 00:00
22 lines
1452 bytes
1452 bytes
The Integer.toString() will give you a character string. This consists of 16-bit characters. I'm guessing here, but it's somewhere to start... To get 8-bit ascii characters from a string, you really should send the string through a byte-stream writer. I think it's possible to send to an in-memory byte-stream but I can't remember how. I also think you might be able to take a quick and dirty short-cut and simply cast the chars to bytes - I believe that most 'normal' chars have 00 in the top byte, and ASCII values in their lower bytes. Steve //------------------------------------- Zhaohua Meng wrote: > > Thank you much. But what I want is the 7 bits ascii character. For > instance, in VB, Chr(12) should give me "c" and Chr(17) is "h". > Integer.toString(17) will give me "17". > > Thank you again.
Technical Details
Message-ID:
<372EB2E1.4AC8@cwcom.co.uk>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<37274CDA.FC4F47C5@TowerComInc.com> <37281610.36B6@cwcom.co.uk> <3729B63A.6EA006DD@TowerComInc.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f74b3,c3bdf6870c3c1ce2 X-Google-Attributes: gidf74b3,public From: Steve Horsley <steve.horsley@cwcom.co.uk> Subject: Re: what class can convert "int" to ASCII? Date: 1999/05/04 Message-ID: <372EB2E1.4AC8@cwcom.co.uk> X-Deja-AN: 473832756 Content-Transfer-Encoding: 7bit References: <37274CDA.FC4F47C5@TowerComInc.com> <37281610.36B6@cwcom.co.uk> <3729B63A.6EA006DD@TowerComInc.com> Organization: Another Netscape Collabra Server User Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 Newsgroups: borland.public.jbuilder.java.language