This week's book giveaway is in the Design forum.
We're giving away four copies of Design for the Mind and have Victor S. Yocco on-line!
See this thread for details.
Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Passing String to Character IS-A Methods

 
Graeme Byers
Ranch Hand
Posts: 127
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Sheriff
Pie
Posts: 20966
31
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Using the "charAt(int)" method of String would reduce the number of lines of code in that example.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic