🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Integer to string conversions

#18389
From: Alexander Anguiano
Date: Mon, 06 Jul 1998 00:00
79 lines
2890 bytes

Richard Wilkman wrote in message <35A154E3.A7479D5B@inprise.com>...
>Alexander:
>
>Anything that comes from Object has a toString() method that can be
>implemented, and all the wrapper classes like Integer and Double have
>this method.
>
>so, you would just use Integer.toString().
>
>However, I see in your code that you are already doing this so I'm
>confused about your question.  Do you want:
>
>a)  Integer to string (as your title indicates)
>b)  primitive int to String?  (in which case you'd do
>String.valueOf())
>
>-Rich
>
>Alexander Anguiano wrote:
>>
>> I was working with a Integer object and I was trying to create a comma
>> delimited string
>>
>> efficiently. Is there another way to convert integers to strings?  (The
>> Integer class only
>>
>> allows me to set the value at construction time.)
>>
>> Have ---
>>  BitSet recordMap ....
>>
>>     for(int i = 0; i < recordMap.size(); i++) {
>>       if (recordMap.get(i)) {
>>         Integer recordNumber = new Integer(i);
>>         if (result.length() == 0)
>>           result.append(recordNumber.toString());
>>         else result.append(','+ recordNumber.toString());
>>       } // if
>>     } // for
>>
>> Want something like this
>>
>>     Integer recordNumber = new Integer();
>>     for(int i = 0; i < recordMap.size(); i++) {
>>       if (recordMap.get(i)) {
>>         recordNumber.setValue(i); //<------------ something like this
>>         if (result.length() == 0)
>>           result.append(recordNumber.toString());
>>         else result.append(','+ recordNumber.toString());
>>       } // if
>>     } // for
>
>--
>
>=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
>Rich Wilkman
>Senior Quality Assurance Engineer
>Borland JBuilder Team
>
>If you see something that looks like an opinion up there,
>it's mine and mine alone.
>
>Mail sent to me from the newsgroups won't bounce but will
>be ignored.  If I have time, I'll respond, but you  have
>a better chance if you confine your posts to the newsgroups
>=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

What I was trying to do was create a string that is something like this
"1,4,5,6,7"

I think the answer
 b)  primitive int to String?  (in which case you'd do
>String.valueOf())

will work.

Thanks
Technical Details
Message-ID: <6nrm73$aen@bgtnsc03.worldnet.att.net>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <6nqmqm$16c@bgtnsc03.worldnet.att.net> <35A154E3.A7479D5B@inprise.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f74b3,e6efa13a8396e245
X-Google-Attributes: gidf74b3,public
From: "Alexander Anguiano" <AlexAnguiano@worldnet.att.net>
Subject: Re: Integer to string conversions
Date: 1998/07/06
Message-ID: <6nrm73$aen@bgtnsc03.worldnet.att.net>
X-Deja-AN: 369046655
References: <6nqmqm$16c@bgtnsc03.worldnet.att.net> <35A154E3.A7479D5B@inprise.com>
X-MimeOLE: Produced By Microsoft MimeOLE V4.72.2106.4
Organization: AT&T WorldNet Services
Newsgroups: borland.public.jbuilder.java.language