Lines Matching defs:str
679 // Returns true if and only if regular expression re matches the entire str.
680 bool RE::FullMatch(const char* str, const RE& re) {
684 return regexec(&re.full_regex_, str, 1, &match, 0) == 0;
688 // str (including str itself).
689 bool RE::PartialMatch(const char* str, const RE& re) {
693 return regexec(&re.partial_regex_, str, 1, &match, 0) == 0;
739 // Returns true if and only if ch appears anywhere in str (excluding the
741 bool IsInSet(char ch, const char* str) {
742 return ch != '\0' && strchr(str, ch) != nullptr;
863 // or +). The behavior is undefined if str contains too many
868 const char* regex, const char* str) {
875 // We know that the atom matches each of the first i characters in str.
876 if (i >= min_count && MatchRegexAtHead(regex, str + i)) {
878 // Since we only care about *whether* the pattern matches str
883 if (str[i] == '\0' || !AtomMatchesChar(escaped, c, str[i])) return false;
888 // Returns true if and only if regex matches a prefix of str. regex must
891 bool MatchRegexAtHead(const char* regex, const char* str) {
897 if (*regex == '$') return *str == '\0';
907 str);
911 // character of str and recurse.
912 return (*str != '\0') && AtomMatchesChar(escaped, *regex, *str) &&
913 MatchRegexAtHead(regex + 1, str + 1);
917 // Returns true if and only if regex matches any substring of str. regex must
925 bool MatchRegexAnywhere(const char* regex, const char* str) {
926 if (regex == nullptr || str == nullptr) return false;
928 if (*regex == '^') return MatchRegexAtHead(regex + 1, str);
930 // A successful match can be anywhere in str.
932 if (MatchRegexAtHead(regex, str)) return true;
933 } while (*str++ != '\0');
941 // Returns true if and only if regular expression re matches the entire str.
942 bool RE::FullMatch(const char* str, const RE& re) {
943 return re.is_valid_ && MatchRegexAnywhere(re.full_pattern_.c_str(), str);
947 // str (including str itself).
948 bool RE::PartialMatch(const char* str, const RE& re) {
949 return re.is_valid_ && MatchRegexAnywhere(re.pattern_.c_str(), str);
1306 // Parses 'str' for a 32-bit signed integer. If successful, writes
1309 bool ParseInt32(const Message& src_text, const char* str, int32_t* value) {
1312 const long long_value = strtol(str, &end, 10); // NOLINT
1320 << " has value \"" << str << "\".\n";
1337 << " has value " << str << ", which overflows.\n";