[CodeHealth] Use std::string::[starts|ends]_with (#26306)

For cases where the comparison is case sensitive, we should use the
methods provided by the common std string types provided since cxx20.
This commit is contained in:
cdesouza-chromium
2024-10-31 13:44:30 +00:00
committed by GitHub
parent aaafc0686d
commit 4e7fcd376f
61 changed files with 115 additions and 135 deletions
@@ -546,7 +546,7 @@ void APIRequestHelper::URLLoaderHandler::ParseSSE(
static constexpr char kDataPrefix[] = "data: {";
std::erase_if(stream_data, [](std::string_view item) {
DVLOG(3) << "Received chunk: " << item;
if (!base::StartsWith(item, kDataPrefix)) {
if (!item.starts_with(kDataPrefix)) {
// This is useful to log in case an API starts
// coming back with unknown data type in some
// scenarios.