Skip to content

Commit

Permalink
libcore: clarify documentation for char_at(_reverse)
Browse files Browse the repository at this point in the history
  • Loading branch information
huonw committed Apr 19, 2013
1 parent d3a58f3 commit 8ae6b33
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/libcore/str.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1863,7 +1863,7 @@ pub fn char_range_at(s: &str, i: uint) -> CharRange {
return CharRange {ch: val as char, next: i};
}

/// Plucks the `n`th character from the beginning of a string
/// Plucks the character starting at the `i`th byte of a string
pub fn char_at(s: &str, i: uint) -> char {
return char_range_at(s, i).ch;
}
Expand All @@ -1874,11 +1874,11 @@ pub struct CharRange {
}

/**
* Given a byte position and a str, return the previous char and its position
* Given a byte position and a str, return the previous char and its position.
*
* This function can be used to iterate over a unicode string in reverse.
*
* returns 0 for next index if called on start index 0
* Returns 0 for next index if called on start index 0.
*/
pub fn char_range_at_reverse(ss: &str, start: uint) -> CharRange {
let mut prev = start;
Expand All @@ -1900,7 +1900,7 @@ pub fn char_range_at_reverse(ss: &str, start: uint) -> CharRange {
return CharRange {ch:ch, next:prev};
}

/// Plucks the `n`th character from the end of a string
/// Plucks the character ending at the `i`th byte of a string
pub fn char_at_reverse(s: &str, i: uint) -> char {
char_range_at_reverse(s, i).ch
}
Expand Down

5 comments on commit 8ae6b33

@bors
Copy link
Contributor

@bors bors commented on 8ae6b33 Apr 19, 2013

Choose a reason for hiding this comment

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

saw approval from thestinger
at huonw@8ae6b33

@bors
Copy link
Contributor

@bors bors commented on 8ae6b33 Apr 19, 2013

Choose a reason for hiding this comment

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

merging huonw/rust/core-char-at-doc = 8ae6b33 into auto

@bors
Copy link
Contributor

@bors bors commented on 8ae6b33 Apr 19, 2013

Choose a reason for hiding this comment

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

huonw/rust/core-char-at-doc = 8ae6b33 merged ok, testing candidate = 465666d

@bors
Copy link
Contributor

@bors bors commented on 8ae6b33 Apr 19, 2013

Choose a reason for hiding this comment

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

@bors
Copy link
Contributor

@bors bors commented on 8ae6b33 Apr 19, 2013

Choose a reason for hiding this comment

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

fast-forwarding incoming to auto = 465666d

Please sign in to comment.