code: public static String getANSIControlSequenceAt(String string, int index) {
          int len = getANSIControlSequenceLength(string, index);
          return len == 0 ? null : string.substring(index,index+len);
      }
docs: Given a string and an index in that string, returns the ANSI control sequence beginning on this index. If there
  is no control sequence starting there, the method will return null. The returned value is the complete escape
  sequence including the ESC prefix.
  @param string String to scan for control sequences
  @param index Index in the string where the control sequence begins
  @return {@code null} if there was no control sequence starting at the specified index, otherwise the entire
  control sequence