title: Algorithm to check sequence numbers
body: <p>I need an algorithm to verify that the password is a sequence of numbers, tried a few, but I did not succeed. Is there any method ready for this?</p>
  
  <p>EDITED: First I received this code in Java, and tried convert it to objective-c:</p>
  
  <pre><code>public static boolean hasSequence(String value) {
      boolean result = true;
      char[] chars = value.toCharArray()
              ;
      for (int i = 1; i &lt; chars.length; i++) {
          if(chars[i] - chars[i - 1] != 1) { // sequence is broken
              result = false;
              break;
          }
      }
  
      return result;
  }
  </code></pre>