mirror of
https://github.com/mrfluffy-dev/kami.git
synced 2026-01-17 04:50:32 +00:00
coolansx you are amazing(make stacking even better)
This commit is contained in:
@@ -1,3 +1,2 @@
|
||||
pub mod fixing_text;
|
||||
pub mod name_ranker;
|
||||
pub mod take_input;
|
||||
|
||||
@@ -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()) //
|
||||
}
|
||||
Reference in New Issue
Block a user