| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/strings/string_split.h" | 5 #include "base/strings/string_split.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/strings/string_util.h" | 8 #include "base/strings/string_util.h" |
| 9 #include "base/third_party/icu/icu_utf.h" | 9 #include "base/third_party/icu/icu_utf.h" |
| 10 | 10 |
| (...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 264 std::vector<string16>* r) { | 264 std::vector<string16>* r) { |
| 265 SplitStringUsingSubstrT(str, s, r); | 265 SplitStringUsingSubstrT(str, s, r); |
| 266 } | 266 } |
| 267 | 267 |
| 268 void SplitStringUsingSubstr(const std::string& str, | 268 void SplitStringUsingSubstr(const std::string& str, |
| 269 const std::string& s, | 269 const std::string& s, |
| 270 std::vector<std::string>* r) { | 270 std::vector<std::string>* r) { |
| 271 SplitStringUsingSubstrT(str, s, r); | 271 SplitStringUsingSubstrT(str, s, r); |
| 272 } | 272 } |
| 273 | 273 |
| 274 void SplitStringDontTrim(StringPiece16 str, | |
| 275 char16 c, | |
| 276 std::vector<string16>* result) { | |
| 277 DCHECK(CBU16_IS_SINGLE(c)); | |
| 278 *result = SplitStringT<string16, string16, char16>( | |
| 279 str, c, KEEP_WHITESPACE, SPLIT_WANT_ALL); | |
| 280 } | |
| 281 | |
| 282 void SplitStringDontTrim(StringPiece str, | |
| 283 char c, | |
| 284 std::vector<std::string>* result) { | |
| 285 #if CHAR_MIN < 0 | |
| 286 DCHECK_GE(c, 0); | |
| 287 #endif | |
| 288 DCHECK_LT(c, 0x7F); | |
| 289 *result = SplitStringT<std::string, std::string, char>( | |
| 290 str, c, KEEP_WHITESPACE, SPLIT_WANT_ALL); | |
| 291 } | |
| 292 | |
| 293 void SplitStringAlongWhitespace(const string16& str, | |
| 294 std::vector<string16>* result) { | |
| 295 *result = SplitStringT<string16, string16, StringPiece16>( | |
| 296 str, StringPiece16(kWhitespaceASCIIAs16), | |
| 297 TRIM_WHITESPACE, SPLIT_WANT_NONEMPTY); | |
| 298 } | |
| 299 | |
| 300 void SplitStringAlongWhitespace(const std::string& str, | |
| 301 std::vector<std::string>* result) { | |
| 302 *result = SplitStringT<std::string, std::string, StringPiece>( | |
| 303 str, StringPiece(kWhitespaceASCII), | |
| 304 TRIM_WHITESPACE, SPLIT_WANT_NONEMPTY); | |
| 305 } | |
| 306 | |
| 307 } // namespace base | 274 } // namespace base |
| OLD | NEW |