Skip to content

Latest commit

 

History

History
52 lines (33 loc) · 1.46 KB

abseil-string-find-str-contains.rst

File metadata and controls

52 lines (33 loc) · 1.46 KB

clang-tidy - abseil-string-find-str-contains

abseil-string-find-str-contains

Finds s.find(...) == string::npos comparisons (for various string-like types) and suggests replacing with absl::StrContains().

This improves readability and reduces the likelihood of accidentally mixing find() and npos from different string-like types.

By default, "string-like types" includes ::std::basic_string, ::std::basic_string_view, and ::absl::string_view. See the StringLikeClasses option to change this.

becomes

Options

StringLikeClasses

Semicolon-separated list of names of string-like classes. By default includes ::std::basic_string, ::std::basic_string_view, and ::absl::string_view.

IncludeStyle

A string specifying which include-style is used, llvm or google. Default is llvm.

AbseilStringsMatchHeader

The location of Abseil's strings/match.h. Defaults to absl/strings/match.h.