summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/string.cpp19
-rw-r--r--src/string.h3
2 files changed, 20 insertions, 2 deletions
diff --git a/src/string.cpp b/src/string.cpp
index ce86c0d..9cf3ffc 100644
--- a/src/string.cpp
+++ b/src/string.cpp
@@ -1103,7 +1103,7 @@ void Bu::String::trimFront( long nAmnt )
1103 core->clear(); 1103 core->clear();
1104 core->appendChunk( pNew ); 1104 core->appendChunk( pNew );
1105} 1105}
1106 1106/*
1107void Bu::String::trimBack( char c ) 1107void Bu::String::trimBack( char c )
1108{ 1108{
1109 if( core->pFirst == NULL || core->nLength == 0 ) 1109 if( core->pFirst == NULL || core->nLength == 0 )
@@ -1113,6 +1113,23 @@ void Bu::String::trimBack( char c )
1113 core->pFirst->pData[core->pFirst->nLength-1] == c; 1113 core->pFirst->pData[core->pFirst->nLength-1] == c;
1114 core->pFirst->nLength--, core->nLength-- ) { } 1114 core->pFirst->nLength--, core->nLength-- ) { }
1115} 1115}
1116*/
1117void Bu::String::trimBack( long iAmnt )
1118{
1119 if( iAmnt < 0 )
1120 return;
1121 if( core->nLength - iAmnt < 0 )
1122 {
1123 clear();
1124 return;
1125 }
1126 if( core->pFirst == NULL || core->nLength == 0 )
1127 return;
1128
1129 flatten();
1130 core->pFirst->nLength -= iAmnt;
1131 core->nLength -= iAmnt;
1132}
1116 1133
1117Bu::String::iterator Bu::String::begin() 1134Bu::String::iterator Bu::String::begin()
1118{ 1135{
diff --git a/src/string.h b/src/string.h
index 59a2cd1..71798db 100644
--- a/src/string.h
+++ b/src/string.h
@@ -923,7 +923,8 @@ namespace Bu
923 */ 923 */
924 void trimFront( long nAmnt ); 924 void trimFront( long nAmnt );
925 925
926 void trimBack( char c ); 926 // void trimBack( char c );
927 void trimBack( long iAmnt );
927 928
928 iterator begin(); 929 iterator begin();
929 930