![]() |
Looking for a < in a string help
I've got an if statemtent that returns true when whitespace is found at an indexed point in a string.
if(Character.isWhitespace(c.charAt(0))) { return true } I want to do the same kind of thing if a < is found. Is there a similar way to do this? Any help would be great. |
:
c.charAt(0) == '<'If you are searching a string for a particular character, you should use the indexOf methods of String instead. Additionally, you can condense the code fragment you provided to one line: :
return Character.isWhitespace(c.charAt(0)); |
You could test string.indexOf('<')!=-1, or you could just use the contains method:
:
class bleh:
jimmy@vera ~/code/randomStuff $ java bleh |
thanks for the replys. I need to find html tags in a string so the
:
c.charAt(0) == '<'method should be sufficient. |
| All times are GMT -5. The time now is 2:00 PM. |
Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC