| View previous topic :: View next topic |
| Author |
Message |
Rod Guest
|
Posted: Mon Aug 15, 2005 4:39 pm Post subject: String Array Uppercase |
|
|
Anyone know of a one liner to convert ALL elements of a String ARRAY to
uppercase ?
Thanks.
|
|
| Back to top |
|
 |
Andrew Thompson Guest
|
Posted: Mon Aug 15, 2005 4:50 pm Post subject: Re: String Array Uppercase |
|
|
On 15 Aug 2005 09:39:53 -0700, Rod wrote:
| Quote: | Anyone know of a one liner
|
Well. Nahh.. it's three lines.
| Quote: | ...to convert ALL elements of a String ARRAY to
uppercase ?
|
Does someone have some homework to do?
--
Andrew Thompson
physci.org 1point1c.org javasaver.com lensescapes.com athompson.info
"..my time is all used up, just to sit around creatin˘ all that groovy kind
of stuff." Spencer Davis Group 'I'm A Man'
|
|
| Back to top |
|
 |
Rod Guest
|
Posted: Mon Aug 15, 2005 5:29 pm Post subject: Re: String Array Uppercase |
|
|
OK ...I'll take a 3 line ...and no , this is NOT homework!
|
|
| Back to top |
|
 |
Rod Guest
|
Posted: Mon Aug 15, 2005 5:39 pm Post subject: Re: String Array Uppercase |
|
|
Well, ....I gues u r thinking of something like this:
for ( int i = foo.length - 1; i>=0; i-- ) {
foo[i] = foo[i].toUpperCase();
}
I just thought there might be something more efficient.
|
|
| Back to top |
|
 |
Andrew Thompson Guest
|
Posted: Mon Aug 15, 2005 6:13 pm Post subject: Re: String Array Uppercase |
|
|
On 15 Aug 2005 10:39:01 -0700, Rod wrote:
| Quote: | Well, ....I gues u r thinking of something like this:
|
Something like that, yes. Though (vaguely) I imagine
I'd have thrown a StringBuffer in there to catch the
resulting upper case String.
| Quote: | for ( int i = foo.length - 1; i>=0; i-- ) {
foo[i] = foo[i].toUpperCase();
}
I just thought there might be something more efficient.
|
Define 'efficient'.
- short (one line as opposed to three)
- small in bytecodes
- small number of CPU cyles to compute..
- for small runs (as opposed to)
- once the JVM performs optimisation on it.. ?
--
Andrew Thompson
physci.org 1point1c.org javasaver.com lensescapes.com athompson.info
"He was a missing person who nobody missed at all" Dixie Chicks 'Goodbye
Earl'
|
|
| Back to top |
|
 |
|