← Back to Gists

Split string by char

📝 Rust
jessicaunderwood
jessicaunderwood · Level 4 ·

Splits a Rust string into an iterator of substrings separated by a specified character.

Rust
let text = String::from("hello,world,rust");
let split: Vec<&str> = text.split(',').collect();
for part in split { println!("{}", part);
}

Comments

No comments yet. Start the discussion.