Skip to content

Commit

Permalink
Rollup merge of rust-lang#88707 - sylvestre:split_example, r=yaahc
Browse files Browse the repository at this point in the history
String.split_terminator: Add an example when using a slice of chars
  • Loading branch information
matthiaskrgr authored Oct 9, 2021
2 parents f875143 + d4031d0 commit 4a775e4
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions library/core/src/str/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1353,6 +1353,9 @@ impl str {
///
/// let v: Vec<&str> = "A..B..".split_terminator(".").collect();
/// assert_eq!(v, ["A", "", "B", ""]);
///
/// let v: Vec<&str> = "A.B:C.D".split_terminator(&['.', ':'][..]).collect();
/// assert_eq!(v, ["A", "B", "C", "D"]);
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
#[inline]
Expand Down Expand Up @@ -1396,6 +1399,9 @@ impl str {
///
/// let v: Vec<&str> = "A..B..".rsplit_terminator(".").collect();
/// assert_eq!(v, ["", "B", "", "A"]);
///
/// let v: Vec<&str> = "A.B:C.D".rsplit_terminator(&['.', ':'][..]).collect();
/// assert_eq!(v, ["D", "C", "B", "A"]);
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
#[inline]
Expand Down

0 comments on commit 4a775e4

Please sign in to comment.