Results 1 to 2 of 2
- 03-08-2012, 07:59 PM #1
Check if a string contains whitespace characters
I want to make a check that find if a string only contains whitespace characters.
I added this: "String".matches("\\s")
This work as long as the strings length is equal to 1. If the string contains two or more spaces(or a tabb space), it will fail.
Tipps?
Edit: Never mind. I found a way, by calling string.trim () and then string.isEmpty ().Last edited by Pojahn_M; 03-08-2012 at 08:10 PM.
- 03-08-2012, 09:16 PM #2
Senior Member
- Join Date
- Oct 2010
- Location
- Germany
- Posts
- 780
- Rep Power
- 4
Similar Threads
-
Check if a string contains characters entered in a array
By roud9 in forum New To JavaReplies: 4Last Post: 11-05-2010, 10:43 AM -
check string inside string
By alacn in forum New To JavaReplies: 8Last Post: 07-07-2010, 12:52 PM -
How to check whether the string contains only the specified characters ????
By j_kathiresan in forum New To JavaReplies: 1Last Post: 04-30-2010, 03:21 PM -
how to get the characters one by one from a String?
By Somitesh Chakraborty in forum New To JavaReplies: 3Last Post: 08-20-2008, 08:56 PM -
Getting all characters in a String
By Alayna in forum New To JavaReplies: 2Last Post: 05-20-2007, 11:49 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks