SplitScript reference / String / startsWith

String.startsWith

Method

String.startsWith(prefix: String) -> bool

Tests whether this string starts with an exact prefix.

Matching is case-sensitive over the UTF-8 text. Every string starts with the empty prefix.

Parameters

  • prefix: The prefix to compare.

Effects: pure

Runtime behavior: available everywhere; synchronous

Examples

Recognize challenge levels

let isChallenge = "Challenge_01".startsWith("Challenge_")