str.cxx

changeset 8
c8bfa7e6ae1b
parent 6
0005527cad62
child 16
393359908179
--- a/str.cxx	Sat Jul 14 02:16:48 2012 +0300
+++ b/str.cxx	Sat Jul 14 04:03:25 2012 +0300
@@ -309,30 +309,22 @@
 
 // ============================================================================
 bool str::isnumber () {
-	return contentcheck (SCCF_NUMBER);
+	ITERATE_STRING (u)
+		if (text[u] < '0' || text[u] > '9')
+			return false;
+	return true;
 }
 
 // ============================================================================
 bool str::isword () {
-	return contentcheck (SCCF_WORD);
-}
-
-bool str::contentcheck (int flags) {
 	ITERATE_STRING (u) {
-		if (flags & SCCF_WORD) {
-			// lowercase letters
-			if (text[u] >= 'a' || text[u] <= 'z')
-				continue;
-			
-			// uppercase letters
-			if (text[u] >= 'A' || text[u] <= 'Z')
-				continue;
-		}
+		// lowercase letters
+		if (text[u] >= 'a' || text[u] <= 'z')
+			continue;
 		
-		if (flags & SCCF_NUMBER) {
-			if (text[u] < '0' || text[u] > '9')
-				return false;
-		}
+		// uppercase letters
+		if (text[u] >= 'A' || text[u] <= 'Z')
+			continue;
 		
 		return false;
 	}

mercurial