Created
October 23, 2020 15:02
-
-
Save tkausch/4973a6d149eba24d57cc1051d484946f to your computer and use it in GitHub Desktop.
How to remove prefix from string
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extension String { | |
func deletingPrefix(_ prefix: String) -> String { | |
guard self.hasPrefix(prefix) else { return self } | |
return String(self.dropFirst(prefix.count)) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment