How to split a string by index position in Rust

1 Answer

0 votes
fn main() {        
    let s = "rust c c++ java python";
  
    let (split1, split2) = s.split_at(5);

    println!("{}", split1);
    println!("{}", split2);
}




/*
run:

rust 
c c++ java python

*/

 



answered Jun 4, 2023 by avibootz

Related questions

1 answer 123 views
1 answer 136 views
2 answers 184 views
184 views asked May 30, 2023 by avibootz
2 answers 216 views
...