Search a list: Difference between revisions
Content added Content deleted
mNo edit summary |
|||
Line 4,365: | Line 4,365: | ||
fn main() { |
fn main() { |
||
mut list, mut index, mut count := "", "", "" |
mut list, mut index, mut count, mut missing := "", "", "", "" |
||
for nee in needles { |
for nee in needles { |
||
for idx, hay in haystacks { |
for idx, hay in haystacks { |
||
Line 4,378: | Line 4,378: | ||
list += "Found: ${nee}; Index: ${index}; Count: ${count}\n" |
list += "Found: ${nee}; Index: ${index}; Count: ${count}\n" |
||
} |
} |
||
} |
} |
||
} |
} |
||
if nee !in haystacks && !missing.contains(nee) {missing += "Missing: ${nee}\n"} |
|||
} |
} |
||
list += missing |
|||
println(list.all_before_last('\n')) |
println(list.all_before_last('\n')) |
||
} |
} |
||
Line 4,389: | Line 4,391: | ||
Found: Bush; Index: 4, 7; Count: 2 |
Found: Bush; Index: 4, 7; Count: 2 |
||
Found: Wally; Index: 2; Count: 1 |
Found: Wally; Index: 2; Count: 1 |
||
Missing: washington |
|||
</pre> |
</pre> |
||