summaryrefslogtreecommitdiff
path: root/indra/llcommon/llstring.h
diff options
context:
space:
mode:
authorGlenn Glazer <coyot@lindenlab.com>2017-05-23 07:59:15 -0700
committerGlenn Glazer <coyot@lindenlab.com>2017-05-23 07:59:15 -0700
commit3fda9bea31327f166dd1067f7e5c9ce251b40289 (patch)
treed7bbf85ac5d6b15ed7d5db8b8b67a1cccbaca4f9 /indra/llcommon/llstring.h
parent4bf1f1d618d61f0cc2ec0dd22cea7d1c5b909b8f (diff)
parentcf5865c6e2b27918b526431ccc4309bfc702534e (diff)
pull from gate
Diffstat (limited to 'indra/llcommon/llstring.h')
-rw-r--r--indra/llcommon/llstring.h23
1 files changed, 23 insertions, 0 deletions
diff --git a/indra/llcommon/llstring.h b/indra/llcommon/llstring.h
index 2fdb8be84f..a6629bc178 100644
--- a/indra/llcommon/llstring.h
+++ b/indra/llcommon/llstring.h
@@ -336,6 +336,7 @@ public:
static void addCRLF(string_type& string);
static void removeCRLF(string_type& string);
+ static void removeWindowsCR(string_type& string);
static void replaceTabsWithSpaces( string_type& string, size_type spaces_per_tab );
static void replaceNonstandardASCII( string_type& string, T replacement );
@@ -1322,6 +1323,28 @@ void LLStringUtilBase<T>::removeCRLF(string_type& string)
//static
template<class T>
+void LLStringUtilBase<T>::removeWindowsCR(string_type& string)
+{
+ const T LF = 10;
+ const T CR = 13;
+
+ size_type cr_count = 0;
+ size_type len = string.size();
+ size_type i;
+ for( i = 0; i < len - cr_count - 1; i++ )
+ {
+ if( string[i+cr_count] == CR && string[i+cr_count+1] == LF)
+ {
+ cr_count++;
+ }
+
+ string[i] = string[i+cr_count];
+ }
+ string.erase(i, cr_count);
+}
+
+//static
+template<class T>
void LLStringUtilBase<T>::replaceChar( string_type& string, T target, T replacement )
{
size_type found_pos = 0;