🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.language
Article #258

Re: Convert ASCII Code to String

#258
From: Arthur Ore
Date: Sat, 23 Sep 2006 22:27
36 lines
2011 bytes
Hi Bernie,

You haven't said why having myChar=68 is "not quite what you want you need" 
for a "D"

Does the following code do help with what you want?

    for (int i=0; i<256; i++)
    {
      System.out.println("i=" + i + ", " + (char) i);
    }

It simply casts the int to a char

Arth

"Bernie Hunt" <bhunt@optonline.net> wrote in message 
news:Xns98477E3712C1Bbhuntoptonlinenet@207.105.83.66...
> I've got an int that holds the ASCII code for a charactor and I need to
> convert that to the char represented by that ASCII code. Example;
>
> int myInt
> char myChar
> myInt = 68 // Ascii code for "D"
> myChar = needs to be a D
>
> But I haven't been able to figure out how to make that happen. I've found 
> a
> couple of ways to make myChar a string equal to 68, hahahaha but not quite
> what I need. I'm working around external data and other people's code so I
> don't really have the option to go back and start in a better way.
>
> Can anyone help with how to assign the ASCII code in a int to a char?
>
> Thanks,
> Bernie 
Technical Details
Message-ID: <4515b4d6@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news2.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <Xns98477E3712C1Bbhuntoptonlinenet@207.105.83.66>

Show Full Headers
Complete Article Headers
X-Google-Thread: f74b3,2160c0f07f672f04
X-Google-Attributes: gidf74b3,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Arthur Ore" <arthur_dot_ore@nospamthx_zen_dot_co.uk>
Newsgroups: borland.public.jbuilder.java.language
References: <Xns98477E3712C1Bbhuntoptonlinenet@207.105.83.66>
Subject: Re: Convert ASCII Code to String
Date: Sat, 23 Sep 2006 23:27:31 +0100
Lines: 38
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2869
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2962
X-RFC2646: Format=Flowed; Original
NNTP-Posting-Host: 82.69.65.131
Message-ID: <4515b4d6@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1159050454 82.69.65.131 (23 Sep 2006 15:27:34 -0700)
Path: arc1-ca.pugleaf.net!g2news2.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail