Thread: Delimiter Fun
View Single Post
Old Jan 15th, 2005, 9:21 AM   #4
Ooble
I eat cake for breakfast.
 
Ooble's Avatar
 
Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9 Ooble is on a distinguished road
You could always write your own:
int count;
 for (int i = 0; str[i]; i++) {
     if (((str[i] & 0xDF) < 'A') || ((str[i] & 0xDF) > 'Z')) {
         count++;
 }
 count++;
That should do it. I believe it's about as fast as you can get, though there's probably more bit operations you can do. In case you hadn't realised, the str[i] & 0xDF bit converts the character to uppercase - it can be replaced by str[i] - 32 if you like.

EDIT: just realised this was the Java section :o - good luck with the conversion. Unfortunately, I don't know Java, so I can't help with that.
__________________
Me :: You :: Them

Last edited by Ooble; Jan 15th, 2005 at 9:27 AM.
Ooble is offline   Reply With Quote