coolansx you are amazing(make stacking even better)

This commit is contained in:
Zastian Pretorius
2022-10-11 12:06:32 +01:00
parent 8ad12ebcca
commit 3ff0a47ff7
5 changed files with 22 additions and 60 deletions

View File

@@ -1,3 +1,2 @@
pub mod fixing_text;
pub mod name_ranker;
pub mod take_input;

View File

@@ -1,20 +0,0 @@
pub fn string_sumularity_ranker(animixplay: Vec<&str>, gogo: &str) -> (usize, String) {
let mut score = 0;
let mut index = 0;
for a in &animixplay {
let mut temp_score = 0;
// compare the each first letter of the strings and then the second and so on without unwrapping
for (_i, (a, b)) in a.chars().zip(gogo.chars()).enumerate() {
if a == b {
temp_score += 1;
} else {
break;
}
}
if temp_score > score {
score = temp_score;
index = animixplay.iter().position(|&x| &x == a).unwrap();
}
}
(index, gogo.to_string()) //
}