Matches a char.

<p>If matched, the char value is extracted.
518053
public static DecomposableMatchBuilder1<Character, Character> caseChar(MatchesAny c) {
    List<Matcher<Object>> matchers = new ArrayList<>();
    matchers.add(any());

    return new DecomposableMatchBuilder1<>(
        matchers, 0, new PrimitiveFieldExtractor<>(Character.class));
  }
1179743
@Deprecated
    public static int matchAfter(CharSequence a, CharSequence b, int aIndex, int bIndex) {
        int i = aIndex, j = bIndex;
        int alen = a.length();
        int blen = b.length();
        for (; i < alen && j < blen; ++i, ++j) {
            char ca = a.charAt(i);
            char cb = b.charAt(j);
            if (ca != cb) {
                break;
            }
        }
        // if we failed a match make sure that we didn't match half a character
        int result = i - aIndex;
        if (result != 0 && !onCharacterBoundary(a, i) && !onCharacterBoundary(b, j)) {
            --result; // backup
        }
        return result;
    }
706295
protected boolean check(String value, String regex) {
		Pattern pattern = Pattern.compile(regex);
		return pattern.matcher(value).matches();
	}
1288982
@Override
	public Object extractValueFromBytes(int offset, byte[] bytes, boolean required) {
		// we don't need to extract the value if all we are doing is matching
		if (!required) {
			return EMPTY;
		}
		if (offset >= bytes.length) {
			return null;
		}
		// length is from the first byte of the string
		int len = (bytes[offset] & 0xFF);
		int left = bytes.length - offset - 1;
		if (len > left) {
			len = left;
		}
		char[] chars = new char[len];
		for (int i = 0; i < chars.length; i++) {
			chars[i] = (char) (bytes[offset + 1 + i] & 0xFF);
		}
		/*
		 * NOTE: we need to make a new string because it might be returned if we don't match below.
		 */
		return new String(chars);
	}
1207121
boolean match(String candidate) {
    char[] chars = candidate.toCharArray();
    int[] cursor = new int[] {0, chars.length};
    if (!checkPrefix(chars, cursor))
      return false;
    if (prefix == suffix && midClauses == null)
      // The pattern consists only of the prefix, which must exhaust the string
      return cursor[0] == cursor[1];
    if (!checkSuffix(chars, cursor))
      return false;
    return matchMiddle(chars, cursor[0], cursor[1]);
  }
286159
public char match(String str1, String str2) {
        if (str1 == null || str2 == null)
            return IMappingElement.IDK;
        if (str1.equals(str2)) {
            return IMappingElement.EQUIVALENCE;
        } else
            return IMappingElement.IDK;
    }
1146627
public static Predicate<CharSequence> contains(Pattern pattern) {
		return t -> pattern.matcher(t).find();
	}
834201
private static boolean containsSpecialCharacter(String value) {
        for (int x = 0; x < value.length(); x++) {
            char c = value.charAt(x);
            if (c == '?' || c == '*') {
                return true;
            } else if (c == '\\') {
                //skip the next character because it is quoted
                x += 1;
            }
        }
        return false;
    }
754573
public boolean matches(CharSequence input) {
        separatorCount = -1;
        separatorIndex = 0;

        if (input == null) {
            this.input = null;
            separatorFlags = null;
            return false;
        }

        this.input = input;
        separatorFlags = new int[input.length()];

        boolean result = matches(pattern, input, separatorFlags);

        if (result) {
            for (int i = separatorFlags.length - 1; i >= 0; i--) {
                if (separatorFlags[i] > 0) {
                    separatorCount = separatorFlags[i];
                    break;
                }
            }
        }

        return result;
    }
1069331
public boolean regionMatchesIgnoreCase(char []cb, int offset, int length)
  {
    int pos = getIndex();

    char ch = current();
    for (int i = 0; i < length; i++) {
      if (ch == DONE) {
        setIndex(pos);
        return false;
      }

      if (Character.toLowerCase(cb[i + offset]) != Character.toLowerCase(ch)) {
        setIndex(pos);
        return false;
      }

      ch = next();
    }

    return true;
  }
491192
public boolean contains(final char ch) {
        final char[] thisBuf = buffer;
        for (int i = 0; i < this.size; i++) {
            if (thisBuf[i] == ch) {
                return true;
            }
        }
        return false;
    }
843720
boolean checkPrefix(char[] chars, int[] cursor) {
    if (prefix == null)
      return true;
    else
      return matchClause(prefix, chars, cursor);
  }
1031721
public boolean match(String value) {
    value = StringUtils.removeStart(value, "/");
    value = StringUtils.removeEnd(value, "/");
    return pattern.matcher(value).matches();
  }
840042
public final int offsetIn(String s) {
    for (int offset = 0; offset < s.length(); ) {
      final int codePoint = s.codePointAt(offset);
      if (matches(codePoint)) {
        return offset;
      }
      offset += Character.charCount(codePoint);
    }
    return NO_MATCH_OFFSET;
  }
983724
@Override
    CharsetMatch match(CharsetDetector det) {
        boolean     hasBOM = false;
        int         numValid = 0;
        int         numInvalid = 0;
        byte        input[] = det.fRawInput;
        int         i;
        int         trailBytes = 0;
        int         confidence;

        if (det.fRawLength >= 3 &&
                (input[0] & 0xFF) == 0xef && (input[1] & 0xFF) == 0xbb && (input[2] & 0xFF) == 0xbf) {
            hasBOM = true;
        }

        // Scan for multi-byte sequences
        for (i=0; i<det.fRawLength; i++) {
            int b = input[i];
            if ((b & 0x80) == 0) {
                continue;   // ASCII
            }

            // Hi bit on char found.  Figure out how long the sequence should be
            if ((b & 0x0e0) == 0x0c0) {
                trailBytes = 1;
            } else if ((b & 0x0f0) == 0x0e0) {
                trailBytes = 2;
            } else if ((b & 0x0f8) == 0xf0) {
                trailBytes = 3;
            } else {
                numInvalid++;
                continue;
            }

            // Verify that we've got the right number of trail bytes in the sequence
            for (;;) {
                i++;
                if (i>=det.fRawLength) {
                    break;
                }
                b = input[i];
                if ((b & 0xc0) != 0x080) {
                    numInvalid++;
                    break;
                }
                if (--trailBytes == 0) {
                    numValid++;
                    break;
                }
            }
        }

        // Cook up some sort of confidence score, based on presense of a BOM
        //    and the existence of valid and/or invalid multi-byte sequences.
        confidence = 0;
        if (hasBOM && numInvalid==0) {
            confidence = 100;
        } else if (hasBOM && numValid > numInvalid*10) {
            confidence = 80;
        } else if (numValid > 3 && numInvalid == 0) {
            confidence = 100;
        } else if (numValid > 0 && numInvalid == 0) {
            confidence = 80;
        } else if (numValid == 0 && numInvalid == 0) {
            // Plain ASCII. Confidence must be > 10, it's more likely than UTF-16, which
            //              accepts ASCII with confidence = 10.
            // TODO: add plain ASCII as an explicitly detected type.
            confidence = 15;
        } else if (numValid > numInvalid*10) {
            // Probably corruput utf-8 data.  Valid sequences aren't likely by chance.
            confidence = 25;
        }
        return confidence == 0 ? null : new CharsetMatch(det, this, confidence);
    }
751682
public Matcher matcher(CharSequence s) {
        Matcher m = new Matcher(this);
        m.setTarget(s);
        return m;
    }
546201
public void contains(CharSequence string) {
    checkNotNull(string);
    if (actual() == null) {
      failWithActual("expected a string that contains", string);
    } else if (!actual().contains(string)) {
      failWithActual("expected to contain", string);
    }
  }