diff --git a/xpcom/ds/nsCRT.cpp b/xpcom/ds/nsCRT.cpp index 4be8544690a9..c9a37d9d2611 100644 --- a/xpcom/ds/nsCRT.cpp +++ b/xpcom/ds/nsCRT.cpp @@ -539,3 +539,46 @@ PRInt32 nsCRT::atoi( const PRUnichar *string ) return atoi(string); } +/** + * Determine if given char in valid alpha range + * + * @update rickg 03.10.2000 + * @param aChar is character to be tested + * @return TRUE if in alpha range + */ +PRBool nsCRT::IsAsciiAlpha(PRUnichar aChar) { + // XXX i18n + if (((aChar >= 'A') && (aChar <= 'Z')) || ((aChar >= 'a') && (aChar <= 'z'))) { + return PR_TRUE; + } + return PR_FALSE; +} + +/** + * Determine if given char is a valid space character + * + * @update rickg 03.10.2000 + * @param aChar is character to be tested + * @return TRUE if is valid space char + */ +PRBool nsCRT::IsAsciiSpace(PRUnichar aChar) { + // XXX i18n + if ((aChar == ' ') || (aChar == '\r') || (aChar == '\n') || (aChar == '\t')) { + return PR_TRUE; + } + return PR_FALSE; +} + + + +/** + * Determine if given char is valid digit + * + * @update rickg 03.10.2000 + * @param aChar is character to be tested + * @return TRUE if char is a valid digit + */ +PRBool nsCRT::IsAsciiDigit(PRUnichar aChar) { + // XXX i18n + return PRBool((aChar >= '0') && (aChar <= '9')); +} diff --git a/xpcom/ds/nsCRT.h b/xpcom/ds/nsCRT.h index ff48ae00ba4a..fa42d150b222 100644 --- a/xpcom/ds/nsCRT.h +++ b/xpcom/ds/nsCRT.h @@ -246,6 +246,12 @@ public: static PRBool IsUpper(PRUnichar aChar); static PRBool IsLower(PRUnichar aChar); + + static PRBool IsAsciiAlpha(PRUnichar aChar); + static PRBool IsAsciiDigit(PRUnichar aChar); + static PRBool IsAsciiSpace(PRUnichar aChar); }; #endif /* nsCRT_h___ */ + +