OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 786 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
797 | 797 |
798 size_t Tokenize(const base::StringPiece& str, | 798 size_t Tokenize(const base::StringPiece& str, |
799 const base::StringPiece& delimiters, | 799 const base::StringPiece& delimiters, |
800 std::vector<base::StringPiece>* tokens) { | 800 std::vector<base::StringPiece>* tokens) { |
801 return TokenizeT(str, delimiters, tokens); | 801 return TokenizeT(str, delimiters, tokens); |
802 } | 802 } |
803 | 803 |
804 template<typename STR> | 804 template<typename STR> |
805 static STR JoinStringT(const std::vector<STR>& parts, | 805 static STR JoinStringT(const std::vector<STR>& parts, |
806 typename STR::value_type sep) { | 806 typename STR::value_type sep) { |
807 if (parts.empty()) return STR(); | 807 if (parts.empty()) |
| 808 return STR(); |
808 | 809 |
809 STR result(parts[0]); | 810 STR result(parts[0]); |
810 typename std::vector<STR>::const_iterator iter = parts.begin(); | 811 typename std::vector<STR>::const_iterator iter = parts.begin(); |
811 ++iter; | 812 ++iter; |
812 | 813 |
813 for (; iter != parts.end(); ++iter) { | 814 for (; iter != parts.end(); ++iter) { |
814 result += sep; | 815 result += sep; |
815 result += *iter; | 816 result += *iter; |
816 } | 817 } |
817 | 818 |
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1087 } | 1088 } |
1088 | 1089 |
1089 } // namespace | 1090 } // namespace |
1090 | 1091 |
1091 size_t base::strlcpy(char* dst, const char* src, size_t dst_size) { | 1092 size_t base::strlcpy(char* dst, const char* src, size_t dst_size) { |
1092 return lcpyT<char>(dst, src, dst_size); | 1093 return lcpyT<char>(dst, src, dst_size); |
1093 } | 1094 } |
1094 size_t base::wcslcpy(wchar_t* dst, const wchar_t* src, size_t dst_size) { | 1095 size_t base::wcslcpy(wchar_t* dst, const wchar_t* src, size_t dst_size) { |
1095 return lcpyT<wchar_t>(dst, src, dst_size); | 1096 return lcpyT<wchar_t>(dst, src, dst_size); |
1096 } | 1097 } |
OLD | NEW |