Skip to main content

Text.contains

containstermcase_sensitivity

Group: Logical
Aliases: contains

Documentation

Checks whether self contains sequence as its substring.

Arguments

  • term: The term to find.
  • case_sensitivity: Specifies if the text values should be compared case sensitively.

Returns

True if term is found within self. False otherwise.

Examples

See if the text "Hello" contains the text "ell".

      "Hello".contains "ell"

See if the text "Cześć" contains the text 's\u301' (which folds to 'ś').

      "Cześć".contains 's\u{301}'

See if the text "Hello!" contains the text 'LO', ignoring case.

      "Hello!".contains "LO" Case_Sensitivity.Insensitive

Remarks

Unicode Equality

The definition of equality includes Unicode canonicalization. I.e. two texts are equal if they are identical after canonical decomposition. This ensures that different ways of expressing the same character in the underlying binary representation are considered equal.

'ś' . contains 's' == False 's\u301' . contains 's' == False 's\u301' . contains 'ś' == True 'ś' . contains 's\u301' == True