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 656 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
667 DCHECK(IsHexDigit(c)); | 667 DCHECK(IsHexDigit(c)); |
668 if (c >= '0' && c <= '9') | 668 if (c >= '0' && c <= '9') |
669 return static_cast<char>(c - '0'); | 669 return static_cast<char>(c - '0'); |
670 if (c >= 'A' && c <= 'F') | 670 if (c >= 'A' && c <= 'F') |
671 return static_cast<char>(c - 'A' + 10); | 671 return static_cast<char>(c - 'A' + 10); |
672 if (c >= 'a' && c <= 'f') | 672 if (c >= 'a' && c <= 'f') |
673 return static_cast<char>(c - 'a' + 10); | 673 return static_cast<char>(c - 'a' + 10); |
674 return 0; | 674 return 0; |
675 } | 675 } |
676 | 676 |
| 677 bool IsUnicodeWhitespace(wchar_t c) { |
| 678 // kWhitespaceWide is a NULL-terminated string |
| 679 for (const wchar_t* cur = kWhitespaceWide; *cur; ++cur) { |
| 680 if (*cur == c) |
| 681 return true; |
| 682 } |
| 683 return false; |
| 684 } |
| 685 |
677 static const char* const kByteStringsUnlocalized[] = { | 686 static const char* const kByteStringsUnlocalized[] = { |
678 " B", | 687 " B", |
679 " kB", | 688 " kB", |
680 " MB", | 689 " MB", |
681 " GB", | 690 " GB", |
682 " TB", | 691 " TB", |
683 " PB" | 692 " PB" |
684 }; | 693 }; |
685 | 694 |
686 string16 FormatBytesUnlocalized(int64 bytes) { | 695 string16 FormatBytesUnlocalized(int64 bytes) { |
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1000 } // namespace | 1009 } // namespace |
1001 | 1010 |
1002 size_t strlcpy(char* dst, const char* src, size_t dst_size) { | 1011 size_t strlcpy(char* dst, const char* src, size_t dst_size) { |
1003 return lcpyT<char>(dst, src, dst_size); | 1012 return lcpyT<char>(dst, src, dst_size); |
1004 } | 1013 } |
1005 size_t wcslcpy(wchar_t* dst, const wchar_t* src, size_t dst_size) { | 1014 size_t wcslcpy(wchar_t* dst, const wchar_t* src, size_t dst_size) { |
1006 return lcpyT<wchar_t>(dst, src, dst_size); | 1015 return lcpyT<wchar_t>(dst, src, dst_size); |
1007 } | 1016 } |
1008 | 1017 |
1009 } // namespace base | 1018 } // namespace base |
OLD | NEW |