Use std::string/string_view versions of starts_with/ends_with where appropriate

The util:: versions of these methods remain as a thin wrapper around them so
they can be used with const char* arguments. Otherwise callers have to manually
make string_view objects from the input.
s Please enter the commit message for your changes. Lines starting
This commit is contained in:
Tim Wojtulewicz 2025-07-11 11:50:12 -07:00
parent 6218643347
commit a1d121e5aa
17 changed files with 30 additions and 55 deletions

View file

@ -1053,8 +1053,7 @@ static zeek::expected<ValPtr, std::string> BuildVal(const rapidjson::Value& j, c
candidate.erase(candidate.size() - 1);
}
// Remove any surrounding "^?(" and ")$?", automatically added below.
if ( candidate.size() > 6 && candidate.substr(0, 3) == "^?(" &&
candidate.substr(candidate.size() - 3, 3) == ")$?" ) {
if ( candidate.size() > 6 && candidate.starts_with("^?(") && candidate.ends_with(")$?") ) {
candidate.erase(0, 3);
candidate.erase(candidate.size() - 3);
}