Allow brackets in download buttons

This commit is contained in:
Christoph Hagen
2023-02-20 15:34:26 +01:00
parent 89245f2553
commit 87d54788db
2 changed files with 13 additions and 2 deletions

View File

@@ -67,10 +67,21 @@ extension String {
extension Substring {
func dropBeforeFirst(_ separator: String) -> String {
guard contains(separator) else {
return String(self)
}
return components(separatedBy: separator).dropFirst().joined(separator: separator)
}
func between(_ start: String, and end: String) -> String {
components(separatedBy: start).last!
.components(separatedBy: end).first!
}
func between(first: String, andLast last: String) -> String {
dropBeforeFirst(first).dropAfterLast(last)
}
}
extension String {