Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions src/libstd/num/int_macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,16 @@ impl Primitive for $T {}
// String conversion functions and impl str -> num

/// Parse a byte slice as a number in the given base.
///
/// Yields an `Option` because `buf` may or may not actually be parseable.
///
/// # Examples
///
/// ```rust
/// let digits = [49,50,51,52,53,54,55,56,57];
/// let base = 10;
/// let num = std::i64::from_str_radix(foo, 10);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't the arguments be digits, base?

/// ```
#[inline]
pub fn parse_bytes(buf: &[u8], radix: uint) -> Option<$T> {
strconv::from_str_bytes_common(buf, radix, true, false, false,
Expand Down
10 changes: 10 additions & 0 deletions src/libstd/num/uint_macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,16 @@ impl Int for $T {}
// String conversion functions and impl str -> num

/// Parse a byte slice as a number in the given base.
///
/// Yields an `Option` because `buf` may or may not actually be parseable.
///
/// # Examples
///
/// ```rust
/// let digits = [49,50,51,52,53,54,55,56,57];
/// let base = 10;
/// let num = std::i64::parse_bytes(digits, base);
/// ```
#[inline]
pub fn parse_bytes(buf: &[u8], radix: uint) -> Option<$T> {
strconv::from_str_bytes_common(buf, radix, false, false, false,
Expand Down