diff options
Diffstat (limited to '')
| -rw-r--r-- | src/common/string_util.cpp | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/src/common/string_util.cpp b/src/common/string_util.cpp index f3ad3d68a..2099eebb8 100644 --- a/src/common/string_util.cpp +++ b/src/common/string_util.cpp | |||
| @@ -168,15 +168,14 @@ void SplitString(const std::string& str, const char delim, std::vector<std::stri | |||
| 168 | output.pop_back(); | 168 | output.pop_back(); |
| 169 | } | 169 | } |
| 170 | 170 | ||
| 171 | std::string TabsToSpaces(int tab_size, const std::string& in) { | 171 | std::string TabsToSpaces(int tab_size, std::string in) { |
| 172 | const std::string spaces(tab_size, ' '); | ||
| 173 | std::string out(in); | ||
| 174 | |||
| 175 | size_t i = 0; | 172 | size_t i = 0; |
| 176 | while (out.npos != (i = out.find('\t'))) | ||
| 177 | out.replace(i, 1, spaces); | ||
| 178 | 173 | ||
| 179 | return out; | 174 | while ((i = in.find('\t')) != std::string::npos) { |
| 175 | in.replace(i, 1, tab_size, ' '); | ||
| 176 | } | ||
| 177 | |||
| 178 | return in; | ||
| 180 | } | 179 | } |
| 181 | 180 | ||
| 182 | std::string ReplaceAll(std::string result, const std::string& src, const std::string& dest) { | 181 | std::string ReplaceAll(std::string result, const std::string& src, const std::string& dest) { |