aboutsummaryrefslogtreecommitdiff
path: root/third_party/chromium/base/strings
diff options
context:
space:
mode:
authorLuis Hector Chavez <lhchavez@google.com>2016-07-22 19:24:07 +0000
committerandroid-build-merger <android-build-merger@google.com>2016-07-22 19:24:07 +0000
commit50cf4188d88e48c2be1eef914bdb5fa7d09557b1 (patch)
tree3e85bd82b5a0d8fd3d267d177a9511469817c939 /third_party/chromium/base/strings
parentb20409af35ba1a15cd260567decb8ce9dca1d091 (diff)
parent7aaba044607c7c4f6a649d2001d6ac213683e8b8 (diff)
downloadlibweave-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.h8
-rw-r--r--third_party/chromium/base/strings/string_util.h7
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