"contains" (string::contains)

Returns true if this string contains an occurrence of the string s, otherwise false.

Synopsis

bool string.contains(string s, CaseSensitivity cs = CaseSensitive);

Parameters

Parameter Description
s String for which the occurrence is checked.
cs

Decides if the search is case sensitive. Can be either:

  • string::CaseSensitive or
  • string::CaseInsensitive

Description

Checks whether the string contains the specified substring.

Example

main()
{
  string s = "Hello World";
  DebugN(s.contains("world", string::CaseSensitive));
  DebugN(s.contains("world", string::CaseInsensitive));
}

Console output:

WCCOAui1:["0"]
WCCOAui1:["1"]

Assignment

String