Count occurrences of a substring: Difference between revisions

Add Rust
(→‎{{header|Haskell}}: Added list-based solutions)
(Add Rust)
Line 1,971:
2</pre>
 
=={{header|Rust}}==
<lang Rust>
fn main() {
println!("{}","the three truths".matches("th").count());
println!("{}","ababababab".matches("abab").count());
}
</lang>
{{out}}
<pre>
3
2
</pre>
=={{header|Scala}}==
===Using Recursion===
678

edits