🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Convert ASCII Code to String

#259
From: Bernie Hunt
Date: Sun, 24 Sep 2006 01:10
61 lines
2389 bytes
Arthur,

Please arrange for my stupid sign to be shipped to my work address. I 
will affix it to my forehead as soon as it arrives.

I was trying 

     myChar = char(myInt);

rather than
    	myChar = (char) myInt;

Thanks to all for your paitent assistance!

Friends don't let friends code when they are tired!

Bernie
             

"Arthur Ore" <arthur_dot_ore@nospamthx_zen_dot_co.uk> wrote in
news:4515b4d6@newsgroups.borland.com: 

> 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: <Xns9847D757024DBbhuntoptonlinenet@207.105.83.66>
Path: arc1-ca.pugleaf.net!g2news2.google.com!news3.google.com!newshub.sdsu.edu!logbridge.uoregon.edu!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail
References: <Xns98477E3712C1Bbhuntoptonlinenet@207.105.83.66> <4515b4d6@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: f74b3,2160c0f07f672f04
X-Google-Attributes: gidf74b3,public
X-Google-Language: ENGLISH,ASCII-7-bit
Newsgroups: borland.public.jbuilder.java.language
Subject: Re: Convert ASCII Code to String
From: Bernie Hunt <bhunt@optonline.net>
References: <Xns98477E3712C1Bbhuntoptonlinenet@207.105.83.66> <4515b4d6@newsgroups.borland.com>
Organization: Cybertec Services
Message-ID: <Xns9847D757024DBbhuntoptonlinenet@207.105.83.66>
User-Agent: Xnews/5.04.25
NNTP-Posting-Host: 69.123.14.249
Date: 23 Sep 2006 18:10:06 -0700
X-Trace: newsgroups.borland.com 1159060206 69.123.14.249 (23 Sep 2006 18:10:06 -0700)
Lines: 62
Path: arc1-ca.pugleaf.net!g2news2.google.com!news3.google.com!newshub.sdsu.edu!logbridge.uoregon.edu!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail