diff options
| author | angelsl <hidingfromhidden@gmail.com> | 2016-10-03 23:37:30 +0800 |
|---|---|---|
| committer | angelsl <hidingfromhidden@gmail.com> | 2016-10-06 00:21:14 +0800 |
| commit | a4e9c392092b5a6d51296470c29f86aaaf255925 (patch) | |
| tree | e338de6263a85139afb730349f3cb7e8cb9d5a26 | |
| parent | 75df685d28947ea7d2422a24f14aa1254da1aeb4 (diff) | |
| download | rust-a4e9c392092b5a6d51296470c29f86aaaf255925.tar.gz rust-a4e9c392092b5a6d51296470c29f86aaaf255925.zip | |
Clarify last element in str.{r,}splitn documentation
| -rw-r--r-- | src/libcollections/str.rs | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/libcollections/str.rs b/src/libcollections/str.rs index 96efe1a03e3..3b9af74b1e7 100644 --- a/src/libcollections/str.rs +++ b/src/libcollections/str.rs @@ -1053,10 +1053,10 @@ impl str { } /// An iterator over substrings of the given string slice, separated by a - /// pattern, restricted to returning at most `count` items. + /// pattern, restricted to returning at most `n` items. /// - /// The last element returned, if any, will contain the remainder of the - /// string slice. + /// If `n` substrings are returned, the last substring (the `n`th substring) + /// will contain the remainder of the string. /// /// The pattern can be a `&str`, [`char`], or a closure that determines the /// split. @@ -1098,16 +1098,16 @@ impl str { /// assert_eq!(v, ["abc", "defXghi"]); /// ``` #[stable(feature = "rust1", since = "1.0.0")] - pub fn splitn<'a, P: Pattern<'a>>(&'a self, count: usize, pat: P) -> SplitN<'a, P> { - core_str::StrExt::splitn(self, count, pat) + pub fn splitn<'a, P: Pattern<'a>>(&'a self, n: usize, pat: P) -> SplitN<'a, P> { + core_str::StrExt::splitn(self, n, pat) } /// An iterator over substrings of this string slice, separated by a /// pattern, starting from the end of the string, restricted to returning - /// at most `count` items. + /// at most `n` items. /// - /// The last element returned, if any, will contain the remainder of the - /// string slice. + /// If `n` substrings are returned, the last substring (the `n`th substring) + /// will contain the remainder of the string. /// /// The pattern can be a `&str`, [`char`], or a closure that /// determines the split. @@ -1145,10 +1145,10 @@ impl str { /// assert_eq!(v, ["ghi", "abc1def"]); /// ``` #[stable(feature = "rust1", since = "1.0.0")] - pub fn rsplitn<'a, P: Pattern<'a>>(&'a self, count: usize, pat: P) -> RSplitN<'a, P> + pub fn rsplitn<'a, P: Pattern<'a>>(&'a self, n: usize, pat: P) -> RSplitN<'a, P> where P::Searcher: ReverseSearcher<'a> { - core_str::StrExt::rsplitn(self, count, pat) + core_str::StrExt::rsplitn(self, n, pat) } /// An iterator over the matches of a pattern within the given string |
