OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "base/string_util.h" | 5 #include "base/string_util.h" |
6 | 6 |
7 #include "build/build_config.h" | 7 #include "build/build_config.h" |
8 | 8 |
9 #include <ctype.h> | 9 #include <ctype.h> |
10 #include <errno.h> | 10 #include <errno.h> |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 found = output->find_first_of(remove_chars); | 177 found = output->find_first_of(remove_chars); |
178 while (found != STR::npos) { | 178 while (found != STR::npos) { |
179 removed = true; | 179 removed = true; |
180 output->replace(found, 1, STR()); | 180 output->replace(found, 1, STR()); |
181 found = output->find_first_of(remove_chars, found); | 181 found = output->find_first_of(remove_chars, found); |
182 } | 182 } |
183 | 183 |
184 return removed; | 184 return removed; |
185 } | 185 } |
186 | 186 |
187 bool RemoveChars(const std::wstring& input, | |
188 const wchar_t remove_chars[], | |
189 std::wstring* output) { | |
190 return RemoveCharsT(input, remove_chars, output); | |
191 } | |
192 | |
193 #if !defined(WCHAR_T_IS_UTF16) | |
194 bool RemoveChars(const string16& input, | 187 bool RemoveChars(const string16& input, |
195 const char16 remove_chars[], | 188 const char16 remove_chars[], |
196 string16* output) { | 189 string16* output) { |
197 return RemoveCharsT(input, remove_chars, output); | 190 return RemoveCharsT(input, remove_chars, output); |
198 } | 191 } |
199 #endif | |
200 | 192 |
201 bool RemoveChars(const std::string& input, | 193 bool RemoveChars(const std::string& input, |
202 const char remove_chars[], | 194 const char remove_chars[], |
203 std::string* output) { | 195 std::string* output) { |
204 return RemoveCharsT(input, remove_chars, output); | 196 return RemoveCharsT(input, remove_chars, output); |
205 } | 197 } |
206 | 198 |
207 template<typename STR> | 199 template<typename STR> |
208 TrimPositions TrimStringT(const STR& input, | 200 TrimPositions TrimStringT(const STR& input, |
209 const typename STR::value_type trim_chars[], | 201 const typename STR::value_type trim_chars[], |
(...skipping 870 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1080 } | 1072 } |
1081 | 1073 |
1082 } // namespace | 1074 } // namespace |
1083 | 1075 |
1084 size_t base::strlcpy(char* dst, const char* src, size_t dst_size) { | 1076 size_t base::strlcpy(char* dst, const char* src, size_t dst_size) { |
1085 return lcpyT<char>(dst, src, dst_size); | 1077 return lcpyT<char>(dst, src, dst_size); |
1086 } | 1078 } |
1087 size_t base::wcslcpy(wchar_t* dst, const wchar_t* src, size_t dst_size) { | 1079 size_t base::wcslcpy(wchar_t* dst, const wchar_t* src, size_t dst_size) { |
1088 return lcpyT<wchar_t>(dst, src, dst_size); | 1080 return lcpyT<wchar_t>(dst, src, dst_size); |
1089 } | 1081 } |
OLD | NEW |