summaryrefslogtreecommitdiff
path: root/comphelper/inc
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2011-08-28 00:17:42 +0100
committerCaolán McNamara <caolanm@redhat.com>2011-08-29 09:56:06 +0100
commit14d2a60053e30dcb7e6956637fe8d57d18563e3f (patch)
treea395e8185afde2031fa255094ee9b0d23f11afe9 /comphelper/inc
parent65302eb1bed16db8f06cbb048d03ba6d644b3fb6 (diff)
remove ByteString::IsAlphaNumericAscii and refactor a bit
Diffstat (limited to 'comphelper/inc')
-rw-r--r--comphelper/inc/comphelper/string.hxx52
1 files changed, 46 insertions, 6 deletions
diff --git a/comphelper/inc/comphelper/string.hxx b/comphelper/inc/comphelper/string.hxx
index 3e74ca452aaa..4daa01b00b6f 100644
--- a/comphelper/inc/comphelper/string.hxx
+++ b/comphelper/inc/comphelper/string.hxx
@@ -268,25 +268,65 @@ public:
const ::com::sun::star::lang::Locale& getLocale() const { return m_aLocale; }
};
-/** Determine if an OString contains solely ascii numeric digits
+/** Determine if an OString contains solely ASCII numeric digits
@param rString An OString
@return false if string contains any characters outside
- the ascii '0'-'9' range
+ the ASCII '0'-'9' range
true otherwise, including for empty string
*/
-COMPHELPER_DLLPUBLIC bool isAsciiDecimalString(const rtl::OString &rString);
+COMPHELPER_DLLPUBLIC bool isdigitAsciiString(const rtl::OString &rString);
-/** Determine if an OUString contains solely ascii numeric digits
+/** Determine if an OUString contains solely ASCII numeric digits
@param rString An OUString
@return false if string contains any characters outside
- the ascii '0'-'9' range
+ the ASCII '0'-'9' range
true otherwise, including for empty string
*/
-COMPHELPER_DLLPUBLIC bool isAsciiDecimalString(const rtl::OUString &rString);
+COMPHELPER_DLLPUBLIC bool isdigitAsciiString(const rtl::OUString &rString);
+
+/** Determine if an OString contains solely ASCII alphanumeric digits
+
+ @param rString An OString
+
+ @return false if string contains any characters outside
+ the ASCII 'a'-'z', 'A'-'Z' and '0'-'9' ranges
+ true otherwise, including for empty string
+ */
+COMPHELPER_DLLPUBLIC bool isalnumAsciiString(const rtl::OString &rString);
+
+/** Determine if an OUString contains solely ASCII alphanumeric digits
+
+ @param rString An OUString
+
+ @return false if string contains any characters outside
+ the ASCII 'a'-'z', 'A'-'Z' and '0'-'9' ranges
+ true otherwise, including for empty string
+ */
+COMPHELPER_DLLPUBLIC bool isalnumAsciiString(const rtl::OString &rString);
+
+COMPHELPER_DLLPUBLIC inline bool isdigitAscii(sal_Unicode c)
+{
+ return ((c >= '0') && (c <= '9'));
+}
+
+COMPHELPER_DLLPUBLIC inline bool islowerAscii(sal_Unicode c)
+{
+ return ((c >= 'a') && (c <= 'z'));
+}
+
+COMPHELPER_DLLPUBLIC inline bool isupperAscii(sal_Unicode c)
+{
+ return ((c >= 'A') && (c <= 'Z'));
+}
+
+COMPHELPER_DLLPUBLIC inline bool isalnumAscii(sal_Unicode c)
+{
+ return isdigitAscii(c) || islowerAscii(c) || isupperAscii(c);
+}
} }