diff options
author | Luis Hector Chavez <lhchavez@google.com> | 2016-07-22 19:24:07 +0000 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2016-07-22 19:24:07 +0000 |
commit | 50cf4188d88e48c2be1eef914bdb5fa7d09557b1 (patch) | |
tree | 3e85bd82b5a0d8fd3d267d177a9511469817c939 /third_party/chromium/base/strings | |
parent | b20409af35ba1a15cd260567decb8ce9dca1d091 (diff) | |
parent | 7aaba044607c7c4f6a649d2001d6ac213683e8b8 (diff) | |
download | libweave-50cf4188d88e48c2be1eef914bdb5fa7d09557b1.tar.gz |
Merge remote-tracking branch \'weave/master\' into \'weave/aosp-master\'
am: 7aaba04460
Change-Id: Iaad8807a03d2535d6fe61511d680dc0b5913c4da
Diffstat (limited to 'third_party/chromium/base/strings')
-rw-r--r-- | third_party/chromium/base/strings/string_number_conversions.h | 8 | ||||
-rw-r--r-- | third_party/chromium/base/strings/string_util.h | 7 |
2 files changed, 15 insertions, 0 deletions
diff --git a/third_party/chromium/base/strings/string_number_conversions.h b/third_party/chromium/base/strings/string_number_conversions.h index af0faa6..49bb08b 100644 --- a/third_party/chromium/base/strings/string_number_conversions.h +++ b/third_party/chromium/base/strings/string_number_conversions.h @@ -24,6 +24,14 @@ // Please do not add "convenience" functions for converting strings to integers // that return the value and ignore success/failure. That encourages people to // write code that doesn't properly handle the error conditions. +// +// DO NOT use these functions in any UI unless it's NOT localized on purpose. +// Instead, use base::MessageFormatter for a complex message with numbers +// (integer, float, double) embedded or base::Format{Number,Double,Percent} to +// just format a single number/percent. Note that some languages use native +// digits instead of ASCII digits while others use a group separator or decimal +// point different from ',' and '.'. Using these functions in the UI would lead +// numbers to be formatted in a non-native way. // ---------------------------------------------------------------------------- namespace base { diff --git a/third_party/chromium/base/strings/string_util.h b/third_party/chromium/base/strings/string_util.h index f505bb6..6b87324 100644 --- a/third_party/chromium/base/strings/string_util.h +++ b/third_party/chromium/base/strings/string_util.h @@ -173,6 +173,13 @@ TrimPositions TrimWhitespaceASCII(const std::string& input, bool IsStringUTF8(const StringPiece& str); bool IsStringASCII(const StringPiece& str); +template <typename Char> +inline bool IsHexDigit(Char c) { + return (c >= '0' && c <= '9') || + (c >= 'A' && c <= 'F') || + (c >= 'a' && c <= 'f'); +} + // Reserves enough memory in |str| to accommodate |length_with_null| characters, // sets the size of |str| to |length_with_null - 1| characters, and returns a // pointer to the underlying contiguous array of characters. This is typically |