Function split_with_separator

Source
pub fn split_with_separator(s: &String, separator_chars: String) -> Vec<String>
Expand description

Splits a string into a vector of strings, using the specified separator characters.

§Arguments

  • s - A String to be split.
  • separator_chars - A String containing the characters to be used as separators.

§Returns

A Vec<String> containing the substrings of the original string, split by the specified separator characters.

§Examples

use rust_string_utils::split_with_separator;
let result = split_with_separator(&"abc,def".to_string(), ",".to_string());
assert_eq!(result, vec!["abc", "def"]);