Hmmmm Interesting Dominik.
Thanks for the information.
It's sure is clean, but didn't know that performance of regexp is
"good" in this case..

What I want is: if a character at index X is a white space. That means
I always have to take first a substring of one character and then do a
match. So besides checking for a whitespace, I also take a substring,
does that still perform well ??...
Besides that: I always understood that object creation should be
reduces as much as possible. In this case it always creates more
objects...

Might it be a good idea to store the pattern in a static field, to
overcome unnecessary pattern compilation?
So do something like this:

private final static Pattern PATTERN_WHITE_SPACE = Pattern.compile("\
\S");
..
...
..
In a helper method:

public static boolean matchWhiteSpace(String input) {
        return PATTERN_WHITE_SPACE.matcher(input).matches();
}



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to