Skip to content

StrStartsWith

Bool StrStartsWith(String findIn, String toFind, Int startIndex = 0, Bool ignoreCase = false)

System · system operation · implicitly imported

Checks whether a String starts with another String, optionally from a given index.

Parameters

  • String findIn — The String to check.
  • String toFind — The prefix to look for.
  • Int startIndex = 0 — The index in findIn where toFind is expected to start.
  • Bool ignoreCase = false — When true, the comparison ignores case.

Returns

Bool — true if toFind occurs in findIn at startIndex.

Errors

A runtime type error if findIn or toFind is not a String, startIndex is not an Int, or ignoreCase is not a Bool.

Examples

Bool b = StrStartsWith("Hello World", "Hello");

See Also