This week's book giveaway is in the Jython/Python forum.
We're giving away four copies of Murach's Python Programming and have Michael Urban and Joel Murach on-line!
See this thread for details.
Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Cast a String to a char  RSS feed

 
Toulouse Laurent
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Anyone know how to cast a String to a char?
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
well, you don't. A String is an Object and a char is a primitive. If the String only has one one char in it, use char aChar = aString.charAt(0);
Dave
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!