wood burning stoves 2.0*
The moose likes Beginning Java and the fly likes Is there a way to ask if a string only 1 character (any 1 character) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Is there a way to ask if a string only 1 character (any 1 character)" Watch "Is there a way to ask if a string only 1 character (any 1 character)" New topic
Author

Is there a way to ask if a string only 1 character (any 1 character)

Nick Rowe
Ranch Hand

Joined: May 26, 2010
Posts: 88
basically i need to search to check if an everchanging string contains more than one character, not a specific one but any SINGLE character in general.

This is as im attempting to return a word value and am getting the odd single character returned occasionally.
Its just a bit more error trapping.

regards S
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 37902
    
  22
Yes. Go through the String API and there are methods telling you how many characters there are.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Is there a way to ask if a string only 1 character (any 1 character)
 
Similar Threads
convert a string into character array
Unicode Character
How to replace apostophes?
regex replacement
what is the meaning of below regular expression