Created
October 2, 2016 00:23
-
-
Save Songbird0/27f9a3575a1492b17340261180ba504a to your computer and use it in GitHub Desktop.
straight to point split function
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fn split(chaine: String) -> Vec<String> | |
{ | |
let lettres = chaine.chars(); | |
let mut newChaine : Vec<String> = Vec::new(); | |
let mut buffer : String = String::new(); | |
for lettre in lettres | |
{ | |
if lettre.is_whitespace() | |
{ | |
newChaine.push(buffer); | |
buffer = String::new(); | |
} | |
else | |
{ | |
buffer.push(lettre); | |
} | |
} | |
return newChaine; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment