code: @Nonnegative
    public static int getLeadingCharCount (@Nullable final String s, final char c)
    {
      int ret = 0;
      if (s != null)
      {
        final int nMax = s.length ();
        while (ret < nMax && s.charAt (ret) == c)
          ++ret;
      }
      return ret;
    }
docs: Get the number of specified chars, the passed string starts with.
  
  @param s
  The string to be parsed. May be <code>null</code>.
  @param c
  The char to be searched.
  @return Always &ge; 0.