/*
Tests a string and returns true if the string counts as a
token.

@param value             the <code>String</code> to be tested

@return                  <code>true</code> if the <code>String</code> is
a token; <code>false</code> if it is not
430042
private static boolean isToken(String value) {
        // ----- BEGIN android -----
        if (RESERVED_NAMES.contains(value.toLowerCase(Locale.US))) {
            return false;
        }
        // ----- END android -----

        int len = value.length();

        for (int i = 0; i < len; i++) {
            char c = value.charAt(i);

            if (c < 0x20 || c >= 0x7f || tspecials.indexOf(c) != -1)
                return false;
        }
        return true;
    }
924685
private static boolean isValidBrace(String url) {
        if (null == url || url.trim().length() == 0) {
            return false;
        }

        boolean isInsideVariable = false;
        StringTokenizer tokenizer = new StringTokenizer(url, "{}", true);
        while (tokenizer.hasMoreTokens()) {
            String token = tokenizer.nextToken();
            if (token.equals("{")) {
                // { is not allowed inside of a variable specification
                if (isInsideVariable) {
                    return false;
                }
                isInsideVariable = true;
            } else if (token.equals("}")) {
                // } must be preceded by {;
                if (!isInsideVariable) {
                    return false;
                }
                isInsideVariable = false;
            }
        }
        return true;
    }
1253758
static boolean isCOctetStringValid(String value, int maxLength) {
        if (value == null)
            return true;
        if (value.length() >= maxLength)
            return false;
        return true;

    }
469654
public static boolean containsEntity(String value)
    {
        assert (value != null) : "Parameter 'value' must not be null";

        int pos = value.indexOf('&');
        if (pos == -1)
            return false;

        int end = value.indexOf(';');
        if (end != -1 && pos < end) {
            // extract the entity and then verify it is
            // a valid unicode identifier.
            String entity = value.substring(pos + 1, end);
            if (entity.length() == 0)
                return false;
            char[] chars = entity.toCharArray();

            // verify the start is an indentifier start
            // and the rest is a part.
            if (!Character.isUnicodeIdentifierStart(chars[0])) {
                if (chars[0] == '#' && chars.length > 1) {
                    for (int i = 1; i < chars.length; i++) {
                        if (!Character.isDigit(chars[i]))
                            return false;
                    }
                    return true;
                }
                return false;
            }
            for (int i = 1; i < chars.length; i++) {
                if (!Character.isUnicodeIdentifierPart(chars[i]))
                    return false;
            }
            // good indentifier
            return true;
        }
        return false;
    }
16096
private boolean isNumeric(String value) {

        if (!CmsStringUtil.isEmpty(value)) {
            NumberFormat formatter = NumberFormat.getInstance();
            ParsePosition pos = new ParsePosition(0);
            formatter.parse(value, pos);
            return value.length() == pos.getIndex();
        } else {
            return false;
        }
    }
935693
public static boolean isNumeric(Object value) {
		if (value == null) return false;
		if (value instanceof Number) return true;
		if (value instanceof String) {
			String stringValue = (String) value;
			if (isNullOrEmpty(stringValue)) return true;
			return isNumber(stringValue);
		}
		return false;
	}
1023767
private boolean isTrue(String value) {

        if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(value)) {
            if (Boolean.valueOf(value.toLowerCase()).booleanValue()
                || value.toLowerCase().equals("on")
                || value.toLowerCase().equals("yes")
                || value.toLowerCase().equals("checked")
                || value.toLowerCase().equals("selected")) {
                return true;
            }
        }
        return false;
    }
1313151
static List<Token> tokenize(final String value) {
		final List<Token> tokens = new ArrayList<>();

		char pc = '\0';
		int pos = 0;
		final StringBuilder token = new StringBuilder();
		for (int i = 0; i < value.length(); ++i) {
			final char c = value.charAt(i);

			if (isTokenSeparator(c) && pc != ESCAPE_CHAR) {
				tokens.add(new Token(unescape(token.toString()), pos));
				tokens.add(new Token(Character.toString(c), i));
				token.setLength(0);
				pos = i;
			} else {
				token.append(c);
			}

			pc = c;
		}

		if (token.length() > 0) {
			tokens.add(new Token(unescape(token.toString()), pos));
		}

		return tokens;
	}
547953
public function checkIsNotString($value = false, $expected = false)
    {
        if (is_string($this->token) || ($value && ($this->token[0] != $value))) {
            $this->bailUnexpectedToken($expected);
        }
    }
225029
function _checkIsHttpToken(val) {
	if (typeof val !== 'string' || val.length === 0) {
		return false;
	}
	if (!_isValidTokenChar(val.charCodeAt(0))) {
		return false;
	}
	const len = val.length;
	if (len > 1) {
		if (!_isValidTokenChar(val.charCodeAt(1))) {
			return false;
		}
		if (len > 2) {
			if (!_isValidTokenChar(val.charCodeAt(2))) {
				return false;
			}
			if (len > 3) {
				if (!_isValidTokenChar(val.charCodeAt(3))) {
					return false;
				}
				for (var i = 4; i < len; i++) {
					if (!_isValidTokenChar(val.charCodeAt(i))) {
						return false;
					}
				}
			}
		}
	}
	return true;
}
1031721
public boolean match(String value) {
    value = StringUtils.removeStart(value, "/");
    value = StringUtils.removeEnd(value, "/");
    return pattern.matcher(value).matches();
  }
761568
@Override
    public Boolean fromString(String value) {
        return value != null && TRUE.contains(value.toLowerCase());
    }
702150
public function checkIsString($value = false, $expected = false)
    {
        if (!is_string($this->token) || ($value && ($this->token != $value))) {
            $this->bailUnexpectedToken($expected);
        }
    }
83644
public static final boolean isValid(final String value) {
        if (value == null) {
            return true;
        }
        final Locale locale;
        final int p = value.indexOf("__");
        if (p > -1) {
            locale = new Locale(value.substring(0, p), null, value.substring(p + 2));
        } else {
            final StringTokenizer tok = new StringTokenizer(value, "_");
            if (tok.countTokens() == 1) {
                locale = new Locale(value);
            } else if (tok.countTokens() == 2) {
                locale = new Locale(tok.nextToken(), tok.nextToken());
            } else if (tok.countTokens() == 3) {
                locale = new Locale(tok.nextToken(), tok.nextToken(), tok.nextToken());
            } else {
                return false;
            }
        }
        return LocaleConverter.validLocale(locale);
    }
1198007
private boolean isTruthy(String value) {
    return value != null &&
           value.trim().toLowerCase().startsWith(TRUTHY_INITIAL_CHARACTER);
  }
957601
public boolean check(String value, String hashString) {
        return update(value.getBytes()).asString().equalsIgnoreCase(hashString);
    }
403641
boolean requires(final String value) {
        if (requires(myPrefix, value) || requires(myPostfix, value)) {
            return true;
        }

        if (mySuffixes == null) {
            return false;
        }
        for (final Literal suffix : mySuffixes) {
            if (requires(suffix, value)) {
                return true;
            }
        }
        return false;
    }