| 180 | } |
| 181 | |
| 182 | void RemoveContinuousBlank(std::string* str) |
| 183 | { |
| 184 | bool first_blank = true; |
| 185 | std::string::size_type end_pos = 0; |
| 186 | std::string::size_type start_pos = 0; |
| 187 | size_t len = str->length(); |
| 188 | |
| 189 | for (start_pos = 0; start_pos != len; start_pos++) |
| 190 | { |
| 191 | if (str->at(start_pos) != ' ') |
| 192 | { |
| 193 | str->at(end_pos) = str->at(start_pos); |
| 194 | end_pos++; |
| 195 | first_blank = true; |
| 196 | } |
| 197 | else |
| 198 | { |
| 199 | if (first_blank) |
| 200 | { |
| 201 | str->at(end_pos) = str->at(start_pos); |
| 202 | end_pos++; |
| 203 | first_blank = false; |
| 204 | } |
| 205 | } |
| 206 | } |
| 207 | str->resize(end_pos); |
| 208 | } |
| 209 | |
| 210 | std::string RemoveContinuousBlank(const StringPiece& str) |
| 211 | { |