File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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


Win a copy of Spring in Action this week in the Spring forum!
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: 18651
    
    8

Using the "charAt(int)" method of String would reduce the number of lines of code in that example.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Passing String to Character IS-A Methods