title: MySQL native similar to PHP substr_count()
body: <p>Is there any function in MySQL that is similar to function <code>substr_count()</code> of PHP?
  Actually I need to know how many items are in a set (eg. <code>1,2,3</code> is 3 items).</p>
  
  <p>In a search, I found nothing that was native to this. So I made a workaround with the methods <code>LENGTH()</code> and <code>REPLACE()</code>.</p>
  
  <pre><code>SELECT LENGTH("1,2,3,4") - LENGTH(REPLACE("1,2,3,4", ",", "")) + 1;
  </code></pre>
  
  <p>But it fail set is empty.<br />
  But I can solve that with a simple <code>IF()</code>.</p>
  
  <p>So, I'm searching for some more native, like, for instance:</p>
  
  <pre><code>SELECT SUBSTR_COUNT(",", "1,2,3,4") + 1;
  </code></pre>
  
  <p>Or, better yet:</p>
  
  <pre><code>SELECT LENGTH_OF_SET("1,2,3,4");
  </code></pre>
  
  <p>Some solution guys?</p>
  
  <p><strong>Edit</strong></p>
  
  <p>Because of some doubts, I'll try to set some examples:</p>
  
  <ul>
  <li><code>1,2,3</code> has 3 items: 1, 2 and 3;</li>
  <li><code>100,200</code> has 2 items: 100 and 200;</li>
  <li><code>1,2,4,9,16,25</code> has 6 items: 1, 2, 4, 9, 16 and 25;</li>
  </ul>
  
  <p>Basically, I want the number that is the number of <strong>commas + 1</strong>. I've got this value, but I was wondering if there is a native way to do this, or a less costly than I did.</p>