summaryrefslogtreecommitdiffstats
path: root/base/string_util.h
diff options
context:
space:
mode:
authortfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-07-23 01:10:46 +0000
committertfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-07-23 01:10:46 +0000
commitb8c1eb454dc4f246c64a6b1b5b472af102e88103 (patch)
tree6413d1400ee4ade44838ecd530736840d1f4f64b /base/string_util.h
parentbe2da4de5227f4f1cbb8455a58045c5e51076474 (diff)
downloadchromium_src-b8c1eb454dc4f246c64a6b1b5b472af102e88103.zip
chromium_src-b8c1eb454dc4f246c64a6b1b5b472af102e88103.tar.gz
chromium_src-b8c1eb454dc4f246c64a6b1b5b472af102e88103.tar.bz2
base: Add IsHexDigit function to string_util.h
Removed duplicated IsHex functions and converted the callers along the way. (Note: this was a TODO for jungshik). BUG=None TEST=trybots Signed-off-by: Thiago Farina <tfarina@chromium.org> Review URL: http://codereview.chromium.org/2870058 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@53428 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/string_util.h')
-rw-r--r--base/string_util.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/base/string_util.h b/base/string_util.h
index 11a9fd2..d7c5635 100644
--- a/base/string_util.h
+++ b/base/string_util.h
@@ -363,6 +363,13 @@ inline bool IsAsciiDigit(Char c) {
return c >= '0' && c <= '9';
}
+template <typename Char>
+inline bool IsHexDigit(Char c) {
+ return (c >= '0' && c <= '9') ||
+ (c >= 'A' && c <= 'F') ||
+ (c >= 'a' && c <= 'f');
+}
+
// Returns true if it's a whitespace character.
inline bool IsWhitespace(wchar_t c) {
return wcschr(kWhitespaceWide, c) != NULL;