summaryrefslogtreecommitdiff
path: root/indra/llui/lltextvalidate.cpp
diff options
context:
space:
mode:
authorsimon@lindenlab.com <simon@lindenlab.com>2011-07-07 17:46:18 -0700
committersimon@lindenlab.com <simon@lindenlab.com>2011-07-07 17:46:18 -0700
commit1cf5ce3a436297e0ac2293eacae7428f231fe1ec (patch)
tree4a074ab4bebd09ff53df696954f0f091cd48327c /indra/llui/lltextvalidate.cpp
parentf5bd2109c27b098dd73a9578f1f032b6ff9e4c2d (diff)
parent66dcc72870b19c6ada65a643ca33c779c9c9989b (diff)
Merge latest from viewer trunk
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);