starts(with:)

Returns a Boolean value indicating whether the initial elements of the sequence are the same as the elements in the specified regex.

iOS
16.0+
macOS
13.0+
tvOS
16.0+
watchOS
9.0+
func starts(with regex: some RegexComponent) -> Bool

Parameters

regex

A regex to compare to this sequence.

Returns

true if the initial elements of the sequence matches the beginning of regex; otherwise, false.