| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 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_util.h" | 5 #include "base/strings/string_util.h" |
| 6 | 6 |
| 7 #include <ctype.h> | 7 #include <ctype.h> |
| 8 #include <errno.h> | 8 #include <errno.h> |
| 9 #include <math.h> | 9 #include <math.h> |
| 10 #include <stdarg.h> | 10 #include <stdarg.h> |
| (...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 337 } | 337 } |
| 338 | 338 |
| 339 bool IsStringASCII(const base::StringPiece& str) { | 339 bool IsStringASCII(const base::StringPiece& str) { |
| 340 return DoIsStringASCII(str); | 340 return DoIsStringASCII(str); |
| 341 } | 341 } |
| 342 | 342 |
| 343 bool IsStringASCII(const base::string16& str) { | 343 bool IsStringASCII(const base::string16& str) { |
| 344 return DoIsStringASCII(str); | 344 return DoIsStringASCII(str); |
| 345 } | 345 } |
| 346 | 346 |
| 347 |
| 348 bool IsHigherCaseHexNumber(const std::string& number) { |
| 349 if (!number.length()) |
| 350 return false; |
| 351 |
| 352 for (size_t i = 0; i < number.length(); ++i) { |
| 353 if (!IsHigherCaseHexDigit(number.at(i))) |
| 354 return false; |
| 355 } |
| 356 |
| 357 return true; |
| 358 } |
| 359 |
| 347 bool IsStringUTF8(const std::string& str) { | 360 bool IsStringUTF8(const std::string& str) { |
| 348 const char *src = str.data(); | 361 const char *src = str.data(); |
| 349 int32 src_len = static_cast<int32>(str.length()); | 362 int32 src_len = static_cast<int32>(str.length()); |
| 350 int32 char_index = 0; | 363 int32 char_index = 0; |
| 351 | 364 |
| 352 while (char_index < src_len) { | 365 while (char_index < src_len) { |
| 353 int32 code_point; | 366 int32 code_point; |
| 354 CBU8_NEXT(src, char_index, src_len, code_point); | 367 CBU8_NEXT(src, char_index, src_len, code_point); |
| 355 if (!base::IsValidCharacter(code_point)) | 368 if (!base::IsValidCharacter(code_point)) |
| 356 return false; | 369 return false; |
| (...skipping 530 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 887 } | 900 } |
| 888 | 901 |
| 889 } // namespace | 902 } // namespace |
| 890 | 903 |
| 891 size_t base::strlcpy(char* dst, const char* src, size_t dst_size) { | 904 size_t base::strlcpy(char* dst, const char* src, size_t dst_size) { |
| 892 return lcpyT<char>(dst, src, dst_size); | 905 return lcpyT<char>(dst, src, dst_size); |
| 893 } | 906 } |
| 894 size_t base::wcslcpy(wchar_t* dst, const wchar_t* src, size_t dst_size) { | 907 size_t base::wcslcpy(wchar_t* dst, const wchar_t* src, size_t dst_size) { |
| 895 return lcpyT<wchar_t>(dst, src, dst_size); | 908 return lcpyT<wchar_t>(dst, src, dst_size); |
| 896 } | 909 } |
| OLD | NEW |