AppletTalk.com Forum Index AppletTalk.com
Java discussions newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

String Array Uppercase

 
Post new topic   Reply to topic    AppletTalk.com Forum Index -> Java Help
View previous topic :: View next topic  
Author Message
Rod
Guest





PostPosted: Mon Aug 15, 2005 4:39 pm    Post subject: String Array Uppercase Reply with quote



Anyone know of a one liner to convert ALL elements of a String ARRAY to
uppercase ?

Thanks.

Back to top
Andrew Thompson
Guest





PostPosted: Mon Aug 15, 2005 4:50 pm    Post subject: Re: String Array Uppercase Reply with quote



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





PostPosted: Mon Aug 15, 2005 5:29 pm    Post subject: Re: String Array Uppercase Reply with quote



OK ...I'll take a 3 line ...and no , this is NOT homework!

Back to top
Rod
Guest





PostPosted: Mon Aug 15, 2005 5:39 pm    Post subject: Re: String Array Uppercase Reply with quote

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





PostPosted: Mon Aug 15, 2005 6:13 pm    Post subject: Re: String Array Uppercase Reply with quote

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
Display posts from previous:   
Post new topic   Reply to topic    AppletTalk.com Forum Index -> Java Help All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.