Search
 
SCRIPT & CODE EXAMPLE
 

RUST

split text on multiple separators and put into a list

use regex::Regex; 

fn main() {
    // split text on multiple separators and put into a list
    let q = "The quick brown fox jumps over the lazy dog's back";
    let separator = Regex::new(r"([ ,.]+)").expect("Invalid regex");
    let words: Vec<_> = separator.split(q).into_iter().collect();
    println!("{:?}", words);
}
Comment

PREVIOUS NEXT
Code Example
Rust :: rustlang get substring 
Rust :: rust random float between 0 and 1 
Lua :: roblox children for loop 
Lua :: roblox make a rainbow part 
Lua :: lua how to get random object from a table 
Lua :: lua not equal 
Lua :: how to remove characters from a string in lua 
Lua :: user input lua 
Lua :: lua destroy 
Lua :: roblox tween color3 
Lua :: lua float to int 
Lua :: roblox brick color 
Lua :: roblox pairs 
Lua :: lua list append 
Lua :: replace part of string lua 
Lua :: lua string split 
Lua :: convert string to lowercase lua 
Lua :: roblox lua get game place id 
Lua :: svelte template vite 
Lua :: check player role in group 
Lua :: Lua dynamic variable name 
Lua :: lua wiki 
Matlab :: how to read dat file in matlab 
Matlab :: matlab find roots of symbolic polynomial 
Basic :: how to close form in vb.net 
Basic :: how to dynamically change the font size of a button visual basic 
Elixir :: elixir timex format 
Elixir :: elixir error 
Scala :: scala home set up 
Excel :: google sheets select first n matches 
ADD CONTENT
Topic
Content
Source link
Name
9+2 =