summaryrefslogtreecommitdiff
path: root/indra/llui/lltextvalidate.cpp
diff options
context:
space:
mode:
authorDon Kjer <don@lindenlab.com>2011-07-08 18:25:07 -0700
committerDon Kjer <don@lindenlab.com>2011-07-08 18:25:07 -0700
commitb9d6b5ef9a9797709397be983ec74c30cd1e0ce2 (patch)
tree9886deac5d65ee1873e8c75ed2af62943c872f63 /indra/llui/lltextvalidate.cpp
parent615cc856a8abf44f62c58962f8b53178f9708ee3 (diff)
parentccb3ad90001c2b19cbd690d67317651ee0182f42 (diff)
Merge viewer-development -> mesh-development
Diffstat (limited to 'indra/llui/lltextvalidate.cpp')
-rw-r--r--indra/llui/lltextvalidate.cpp33
1 files changed, 33 insertions, 0 deletions
diff --git a/indra/llui/lltextvalidate.cpp b/indra/llui/lltextvalidate.cpp
index 4b9faa0560..234e600ccd 100644
--- a/indra/llui/lltextvalidate.cpp
+++ b/indra/llui/lltextvalidate.cpp
@@ -188,6 +188,39 @@ namespace LLTextValidate
return success;
}
+ bool validateNonNegativeS32NoSpace(const LLWString &str)
+ {
+ LLLocale locale(LLLocale::USER_LOCALE);
+
+ LLWString test_str = str;
+ S32 len = test_str.length();
+ bool success = TRUE;
+ if(0 < len)
+ {
+ if('-' == test_str[0])
+ {
+ success = FALSE;
+ }
+ S32 i = 0;
+ while(success && (i < len))
+ {
+ if(!LLStringOps::isDigit(test_str[i]) || LLStringOps::isSpace(test_str[i++]))
+ {
+ success = FALSE;
+ }
+ }
+ }
+ if (success)
+ {
+ S32 val = strtol(wstring_to_utf8str(test_str).c_str(), NULL, 10);
+ if (val < 0)
+ {
+ success = FALSE;
+ }
+ }
+ return success;
+ }
+
bool validateAlphaNum(const LLWString &str)
{
LLLocale locale(LLLocale::USER_LOCALE);