xtd 0.2.0
contains.cpp

Shows how to use xtd::string::contains method.

#include <xtd/console>
#include <xtd/string>
using namespace xtd;
auto main() -> int {
auto s = "This is a literal string";
console::write_line("The string: \""_s + s + "\""_s + (string {s}.contains("is") ? " contains " : " does not contain ") + "\"is\" substring."_s);
console::write_line("The string: \""_s + s + "\""_s + (string {s}.contains("z") ? " contains " : " does not contain ") + "\"z\" character."_s);
}
// This code produces the following output :
//
// The string: "This is a literal string" contains "is" substring.
// The string: "This is a literal string" does not contain "z" character.
static void write_line()
Writes the current line terminator to the standard output stream using the specified format informati...
@ s
The S key.
Definition console_key.hpp:124
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition abstract_object.hpp:8