Re: char to string ????
From: Phil... (rynes_at_ieee.org)
Date: 10/28/03
- Next message: Phil...: "Re: How to set Permissions on New File"
- Previous message: Hal Vaughan: "Re: How to set Permissions on New File"
- In reply to: Glen Herrmannsfeldt: "Re: char to string ????"
- Next in thread: Glen Herrmannsfeldt: "Re: char to string ????"
- Reply: Glen Herrmannsfeldt: "Re: char to string ????"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Tue, 28 Oct 2003 17:17:54 GMT
my book says left to right also
"Glen Herrmannsfeldt" <gah@ugcs.caltech.edu> wrote in message
news:I6onb.47477$HS4.225638@attbi_s01...
>
> "Tarken" <tarken@lycos.co.uk> wrote in message
> news:e9358f13.0310271213.11aa5c46@posting.google.com...
> > HGA03630@nifty.ne.jp (hiwa) wrote in message
> news:<6869384d.0310250203.395b69ce@posting.google.com>...
> > > "Jova" <Name@dotcom.com> wrote in message
> news:<FRemb.14426$gA1.4132498@news4.srv.hcvlny.cv.net>...
> > > > Is there a method or way for me to take a couple of char's and make
a
> sting
> > > > out of them .
> > > >
> > > > Example of what I want to do.
> > > >
> > > > String | char
> > > > b = b
> > > > ba = a
> > > > bad = d
> > > couple of char ... char[] couple = {'m', 'f'};
> > > make a string ... String s = new String(couple); // "mf"
> > >
> > > Is this what you want?
> >
> > Another approach would be, where 'b', 'a' and 'd' are chars:
> >
> > String s = b + a + d + "";
> >
> > Generally any concatenation involving a string results in a String.
> > So if you need to a sum, at the same time, you need to isolate it
> > in brackets:
> >
> > String s = b + (1+3) + d + "";
>
> I thought it would evaluate left to right, so String s = b + a + d + "";
> would be equivalent to
>
> String s = ((( b + a ) + d ) + ""; which is not what was asked for. If
you
> put the "" first it should work, though. If b, a, and d are int's that is
> what it would do. It might treat char specially.
>
> You can also create a StringBuffer, add the chars one at a time, and then
> make a String from it.
>
> -- glen
>
>
>
- Next message: Phil...: "Re: How to set Permissions on New File"
- Previous message: Hal Vaughan: "Re: How to set Permissions on New File"
- In reply to: Glen Herrmannsfeldt: "Re: char to string ????"
- Next in thread: Glen Herrmannsfeldt: "Re: char to string ????"
- Reply: Glen Herrmannsfeldt: "Re: char to string ????"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|