This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Passing String to Character IS-A Methods Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Passing String to Character IS-A Methods" Watch "Passing String to Character IS-A Methods" New topic
Author

Passing String to Character IS-A Methods

Graeme Byers
Ranch Hand

Joined: Apr 16, 2004
Posts: 127
Is there are better way than this ?
String aLetter = "A" ;
char [] charArray = new char[1] ;
charArray = aLetter.toCharArray() ;
boolean b = Character.isLetter(charArray[0]) ;
Thank you.
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18570
    
    8

Using the "charAt(int)" method of String would reduce the number of lines of code in that example.
 
GeeCON Prague 2014
 
subject: Passing String to Character IS-A Methods