This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
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


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: 43970
    
  33
Yes. Go through the String API and there are methods telling you how many characters there are.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Is there a way to ask if a string only 1 character (any 1 character)
 
It's not a secret anymore!