title: How do I count the number of occurrences of a char in a String?
body: <p>I have the string </p>
  
  <pre><code>a.b.c.d
  </code></pre>
  
  <p>I want to count the occurrences of '.' in an idiomatic way, preferably a one-liner.</p>
  
  <p>(Previously I had expressed this constraint as "without a loop", in case you're wondering why everyone's trying to answer without using a loop).</p>