Explorar el Código

Solved hw1/task3 and ran all tests successfully

Joshua Rutschmann hace 8 años
padre
commit
3711024edb
Se han modificado 1 ficheros con 7 adiciones y 1 borrados
  1. 7
    1
      hw1/task3/src/lib.rs

+ 7
- 1
hw1/task3/src/lib.rs Ver fichero

@@ -1,3 +1,9 @@
1 1
 pub fn count(line: &str, c: char) -> u64 {
2
-    unimplemented!();
2
+   let mut occurances = 0;
3
+   for char in line.chars(){
4
+      if char == c {
5
+        occurances += 1;
6
+      }
7
+   }
8
+   occurances
3 9
 }

Loading…
Cancelar
Guardar