• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 //
5 // The original source code is from:
6 // http://src.chromium.org/viewvc/chrome/trunk/src/base/strings/string_split.h?revision=236210
7 //
8 // Modifications from original:
9 //   1) Supports only std::string type.
10 //   2) Does not trim whitespace.
11 
12 #ifndef I18N_ADDRESSINPUT_UTIL_STRING_SPLIT_H_
13 #define I18N_ADDRESSINPUT_UTIL_STRING_SPLIT_H_
14 
15 #include <string>
16 #include <vector>
17 
18 namespace i18n {
19 namespace addressinput {
20 
21 // Splits |str| into a vector of strings delimited by |c|, placing the results
22 // in |r|. If several instances of |c| are contiguous, or if |str| begins with
23 // or ends with |c|, then an empty string is inserted.
24 //
25 // |str| should not be in a multi-byte encoding like Shift-JIS or GBK in which
26 // the trailing byte of a multi-byte character can be in the ASCII range.
27 // UTF-8, and other single/multi-byte ASCII-compatible encodings are OK.
28 // Note: |c| must be in the ASCII range.
29 void SplitString(const std::string& str, char c, std::vector<std::string>* r);
30 
31 }  // namespace addressinput
32 }  // namespace i18n
33 
34 #endif  // I18N_ADDRESSINPUT_UTIL_STRING_SPLIT_H_
35