Skip to main content

split_fixed

Function split_fixed 

Source
pub fn split_fixed(input: &str, pat: &str) -> Vec<String>
Expand description

§Split a string by a fixed pattern

In Rust, when you use the split method on a string (or a slice of characters) with a pattern that isn’t found in the string, it will indeed return a vector containing a single empty string slice, vec![""]. This behavior is a part of how Rust’s split method is designed, and it might be unexpected if you’re not familiar with the details of how split works.