diff options
Diffstat (limited to 'src/string.cpp')
-rw-r--r-- | src/string.cpp | 19 |
1 files changed, 18 insertions, 1 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 | /* | |
1107 | void Bu::String::trimBack( char c ) | 1107 | void 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 | */ | ||
1117 | void 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 | ||
1117 | Bu::String::iterator Bu::String::begin() | 1134 | Bu::String::iterator Bu::String::begin() |
1118 | { | 1135 | { |