summaryrefslogtreecommitdiff
path: root/absl/strings/numbers.h
diff options
context:
space:
mode:
Diffstat (limited to 'absl/strings/numbers.h')
-rw-r--r--absl/strings/numbers.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/absl/strings/numbers.h b/absl/strings/numbers.h
index ffc738fa..7966e250 100644
--- a/absl/strings/numbers.h
+++ b/absl/strings/numbers.h
@@ -1,3 +1,4 @@
+//
// Copyright 2017 The Abseil Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
@@ -244,6 +245,13 @@ inline size_t FastHexToBufferZeroPad16(uint64_t val, char* out) {
} // namespace numbers_internal
+// SimpleAtoi()
+//
+// Converts a string to an integer, using `safe_strto?()` functions for actual
+// parsing, returning `true` if successful. The `safe_strto?()` functions apply
+// strict checking; the string must be a base-10 integer, optionally followed or
+// preceded by ASCII whitespace, with a value in the range of the corresponding
+// integer type.
template <typename int_type>
ABSL_MUST_USE_RESULT bool SimpleAtoi(absl::string_view str, int_type* out) {
return numbers_internal::safe_strtoi_base(str, out, 10);