StringProtocol
extension StringProtocol
This adds various functionality to Strings
-
This tests a string to see if a given substring is present at the start.
Declaration
Swift
func beginsWith(_ inSubstring: String) -> Bool
Parameters
inSubstring
The substring to test.
Return Value
true, if the string begins with the given substring.
-
This tests a string to see if a given substring is present at the end.
Declaration
Swift
func endsWith(_ inSubstring: String) -> Bool
Parameters
inSubstring
The substring to test.
Return Value
true, if the string ends with the given substring.
-
This tests a string to see if a given substring is present anywhere
Declaration
Swift
func contains(_ inSubstring: String) -> Bool
Parameters
inSubstring
The substring to test.
Return Value
true, if the string contains the given substring.