Return a String containing a copy of the chars in this buffer, limited to the
[start, end[ range.
@hide
962761
public String substring(int start, int end) {
        char[] buf = new char[end - start];
        getChars(start, end, buf, 0);
        return new String(buf);
    }
1209111
public static String getString(ByteBuffer buf, Charset encoding) {
        return getString(buf, 0, buf.remaining(), encoding);
    }
512381
public static String sliceOf( String str, int start, int end ) {
        return slc(str, start, end);
    }
249725
private static int findStart( char[] buffer, int start, int end )
    {
        int pos, cp;
        for ( pos = start; pos < end && isWhitespace( cp = codePointAt( buffer, pos ) ); pos += charCount( cp ) )
        {
            if ( cp == '\n' )
            {
                start = pos + 1;
            }
        }
        return pos >= end ? end : start;
    }
295094
private String nextString() {
    assert input.charAt(idx - 1) == '"' : "Char is '" + input.charAt(idx - 1) + '\'';
    StringBuilder sb = new StringBuilder();
    while (true) {
      char c = nextChar();
      switch (c) {
        case '\n':
        case '\r':
          throw new IllegalArgumentException("Unterminated string");
        case '\\':
          c = nextChar();
          switch (c) {
            case 'b':
              sb.append('\b');
              break;
            case 't':
              sb.append('\t');
              break;
            case 'n':
              sb.append('\n');
              break;
            case 'f':
              sb.append('\f');
              break;
            case 'r':
              sb.append('\r');
              break;
            case 'u':
              sb.append((char) Integer.parseInt(input.substring(idx, idx + 4), 16));
              idx += 4;
              break;
            case '"':
            case '\'':
            case '\\':
            case '/':
              sb.append(c);
              break;
            default:
              throw new IllegalArgumentException("Illegal escape");
          }
          break;
        default:
          if (c == '"') {
            return sb.toString();
          }
          sb.append(c);
      }
    }
  }
376560
public StringBuffer toStringBuffer() {
        StringBuffer sb = new StringBuffer(length);
        sb.append(c, 0, length);
        return sb;
    }
768520
public UTF8String substring(final int start, final int until) {
    if (until <= start || start >= numBytes) {
      return EMPTY_UTF8;
    }

    int i = 0;
    int c = 0;
    while (i < numBytes && c < start) {
      i += numBytesForFirstByte(getByte(i));
      c += 1;
    }

    int j = i;
    while (i < numBytes && c < until) {
      i += numBytesForFirstByte(getByte(i));
      c += 1;
    }

    if (i > j) {
      byte[] bytes = new byte[i - j];
      copyMemory(base, offset + j, bytes, BYTE_ARRAY_OFFSET, i - j);
      return fromBytes(bytes);
    } else {
      return EMPTY_UTF8;
    }
  }
752027
public static FastStr of(String s) {
        int sz = s.length();
        if (sz == 0) return EMPTY_STR;
        char[] buf = s.toCharArray();
        return new FastStr(buf, 0, sz);
    }
865912
private String extractString(char[] data, int start, int end) {
        // skip leading whitespace and quotes
        while (start < end &&
               (' ' == data[start] || '\t' == data[start] || '"' == data[start])) {
            start++;
        }
        // ignore trailing whitespace and quotes
        while (end >= start &&
               (' ' == data[end] || '\t' == data[end] || '"' == data[end])) {
            end--;
        }
        // check for nothing but whitespace
        if (end < start) {
            return null;
        }
        int len = end - start + 1;
        String rc = Normalizer.normalize(new String(data, start, len), Normalizer.NORMALIZE_LOWER);
        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
            Tr.debug(tc, "extractString: [" + rc + "]");
        }
        return rc;
    }
412109
private static char[] copyOf(char[] original, int length) {
    char[] copy = new char[length];
    System.arraycopy(original, 0, copy, 0, Math.min(original.length, length));
    return copy;
  }
704510
public function take(): string
    {
        if ($this->atEnd()) {
            $this->lastTaken = self::END;

            return self::END;
        }

        $char = $this->input[$this->index];

        $this->index += 1;

        $this->lastTaken = $char;

        return $char;
    }
433589
public static String generate(final int chars) {
        final SecureRandom secureRandom = new SecureRandom();
        final char[] buff = new char[chars];
        for (int i = 0; i < chars; ++i) {
            if (i % 10 == 0) {
                secureRandom.setSeed(secureRandom.nextLong());
            }
            buff[i] = VALID_CHARACTERS[secureRandom.nextInt(VALID_CHARACTERS.length)];
        }
        return new String(buff);
    }
823035
def chars_until str
      slice_str = @str.check_until(Regexp.new(Regexp.escape(str)))
      return chars_left unless slice_str
      return slice_str.size - str.size
    end
1319130
public static Characters of(char... chars) {
        return chars.length == 0 ? Characters.NONE : new Characters(false, chars.clone());
    }
609021
public String nextString()
    {
        char[] buffer = new char[nextInt()];
        for (int i = 0; i < buffer.length; ++i)
        {
            buffer[i] = nextChar();
        }
        return new String(buffer);
    }
1359339
private char nextChar() throws IOException {
		if (missedChar != null) {
			// RETURNS THE PREVIOUS PARSED CHAR
			c = missedChar.charValue();
			missedChar = null;

		} else {
			c = (char) in.read();

			if (c == '\\') {
				char c2 = (char) in.read();
				if (c2 == 'u') {
					// DECODE UNICODE CHAR
					final StringBuilder buff = new StringBuilder();
					for (int i = 0; i < 4; ++i)
						buff.append((char) in.read());

					cursor += 6;

					return (char) Integer.parseInt(buff.toString(), 16);
				} else {
					// REMEMBER THE CURRENT CHAR TO RETURN NEXT TIME
					missedChar = c2;
				}
			}
		}

		cursor++;

		if (c == NEW_LINE) {
			++lineNumber;
			columnNumber = 0;
		} else
			++columnNumber;

		return c;
	}

	public char lastChar() {
		return c;
	}

	public String getValue() {
		return value;
	}

	public int getLineNumber() {
		return lineNumber;
	}

	public int getColumnNumber() {
		return columnNumber;
	}

	public boolean hasNext() throws IOException {
		return in.ready();
	}
}
256866
public String getString() throws IOException {
        ByteArrayInputStream in = new ByteArrayInputStream(buf);
        int                  c;
        StringWriter         w = new StringWriter();
        while (((c = in.read()) != 0) && (c != -1)) {
            w.write((char) c);
        }
        return w.getBuffer().toString();
    }