Skip to content

Instantly share code, notes, and snippets.

@Songbird0
Created October 2, 2016 00:23
Show Gist options
  • Save Songbird0/27f9a3575a1492b17340261180ba504a to your computer and use it in GitHub Desktop.
Save Songbird0/27f9a3575a1492b17340261180ba504a to your computer and use it in GitHub Desktop.
straight to point split function
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