Return a string representation of a portion of `input` at offset `pos`. The result will contain exactly `len` characters.
502196
function getInputExcerpt(input, pos, len) {
  var excerpt = asEscapedString(input.slice(pos, pos + len));

  // Pad the output if necessary.
  if (excerpt.length < len) {
    return excerpt + common.repeat(' ', len - excerpt.length).join('');
  }
  return excerpt;
}
377991
def relevant_part(self, original, pos, sep=' '):
        
        start = original.rfind(sep, 0, pos) + 1
        end = original.find(sep, pos - 1)
        if end == -1:
            end = len(original)
        return original[start:end], start, end, pos - start
118765
private char peek(int offset) {
    return _x + offset < _str.length() ? _str.charAt(_x + offset) : ' ';
  }
136705
public String getSubString(long pos, int length) throws SQLException {

    if (pos < 1) {
      throw ExceptionMapper.getSqlException("position must be >= 1");
    }

    if (length < 0) {
      throw ExceptionMapper.getSqlException("length must be > 0");
    }

    try {
      String val = toString();
      return val.substring((int) pos - 1, Math.min((int) pos - 1 + length, val.length()));
    } catch (Exception e) {
      throw new SQLException(e);
    }
  }
918885
def read_string(buff, byteorder='big'):
    """"""
    length = read_numeric(USHORT, buff, byteorder)
    return buff.read(length).decode('utf-8')
527015
def read_character_string(self):
        """"""
        length = ord(self.data[self.offset])
        self.offset += 1
        return self.read_string(length)
289067
def peek(self) -> str:
        
        try:
            return self.input[self.offset]
        except IndexError:
            raise EndOfInput(self)
130202
def readString(self):
        
        resultStr = ""
        while self.data[self.offset] != "\x00":
            resultStr += self.data[self.offset]
            self.offset += 1
        return resultStr
301029
def read_to_offset(self, offset):
    
    assert offset >= self._offset
    result = self._buffer[self._offset: offset]
    self._offset += len(result)
    return result
9417
def lengths_offsets(value):
    
    values = []
    for item in value.split(','):
        item = int(item)
        values.append(item)
    return values
1144684
def _lengstr(obj):
    '''
    '''
    n = leng(obj)
    if n is None:  # no len
       r = ''
    elif n > _len(obj):  # extended
       r = ' leng %d!' % n
    else:
       r = ' leng %d' % n
    return r
1316878
def _get_len(self):
        
        if hasattr(self._buffer, 'len'):
            self._len = self._buffer.len

            return

        old_pos = self._buffer.tell()
        self._buffer.seek(0, 2)

        self._len = self._buffer.tell()
        self._buffer.seek(old_pos)
1015445
def accept_lit(char, buf, pos):
    """"""
    if pos >= len(buf) or buf[pos] != char:
        return None, pos
    return char, pos+1
28749
def _readtoken(self, name, pos, length):
        """"""
        if length is not None and int(length) > self.length - pos:
            raise ReadError("Reading off the end of the data. "
                            "Tried to read {0} bits when only {1} available.".format(int(length), self.length - pos))
        try:
            val = name_to_read[name](self, length, pos)
            return val, pos + length
        except KeyError:
            if name == 'pad':
                return None, pos + length
            raise ValueError("Can't parse token {0}:{1}".format(name, length))
        except TypeError:
            # This is for the 'ue', 'se' and 'bool' tokens. They will also return the new pos.
            return name_to_read[name](self, pos)
520044
def _get_c_string(data, position):
    """"""
    end = data.index(b"\x00", position)
    return _utf_8_decode(data[position:end], None, True)[0], end + 1
565975
def _transpose_chars(text, pos):
    
    if len(text) < 2 or pos == 0:
        return text, pos
    if pos == len(text):
        return text[:pos - 2] + text[pos - 1] + text[pos - 2], pos
    return text[:pos - 1] + text[pos] + text[pos - 1] + text[pos + 1:], pos + 1
775743
public final String getString(final int pos, String charsetName) {
        if (pos >= limit || pos < 0) throw new IllegalArgumentException("limit excceed: " + pos);

        byte[] buf = buffer;
        final int len = (0xff & buf[origin + pos]);
        if (pos + len + 1 > limit) throw new IllegalArgumentException("limit excceed: " + (pos + len + 1));

        try {
            return new String(buf, origin + pos + 1, len, charsetName);
        } catch (UnsupportedEncodingException e) {
            throw new IllegalArgumentException("Unsupported encoding: " + charsetName, e);
        }
    }