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 bool IsUpperCaseHexNumber(const std::string& number) { |
| 348 if (!number.length()) |
| 349 return false; |
| 350 |
| 351 for (size_t i = 0; i < number.length(); ++i) { |
| 352 if (!IsUpperCaseHexDigit(number.at(i))) |
| 353 return false; |
| 354 } |
| 355 |
| 356 return true; |
| 357 } |
| 358 |
347 bool IsStringUTF8(const std::string& str) { | 359 bool IsStringUTF8(const std::string& str) { |
348 const char *src = str.data(); | 360 const char *src = str.data(); |
349 int32 src_len = static_cast<int32>(str.length()); | 361 int32 src_len = static_cast<int32>(str.length()); |
350 int32 char_index = 0; | 362 int32 char_index = 0; |
351 | 363 |
352 while (char_index < src_len) { | 364 while (char_index < src_len) { |
353 int32 code_point; | 365 int32 code_point; |
354 CBU8_NEXT(src, char_index, src_len, code_point); | 366 CBU8_NEXT(src, char_index, src_len, code_point); |
355 if (!base::IsValidCharacter(code_point)) | 367 if (!base::IsValidCharacter(code_point)) |
356 return false; | 368 return false; |
(...skipping 530 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
887 } | 899 } |
888 | 900 |
889 } // namespace | 901 } // namespace |
890 | 902 |
891 size_t base::strlcpy(char* dst, const char* src, size_t dst_size) { | 903 size_t base::strlcpy(char* dst, const char* src, size_t dst_size) { |
892 return lcpyT<char>(dst, src, dst_size); | 904 return lcpyT<char>(dst, src, dst_size); |
893 } | 905 } |
894 size_t base::wcslcpy(wchar_t* dst, const wchar_t* src, size_t dst_size) { | 906 size_t base::wcslcpy(wchar_t* dst, const wchar_t* src, size_t dst_size) { |
895 return lcpyT<wchar_t>(dst, src, dst_size); | 907 return lcpyT<wchar_t>(dst, src, dst_size); |
896 } | 908 } |
OLD | NEW |