Add single file audio player, introduce blocks
This commit is contained in:
@ -9,6 +9,13 @@ extension String {
|
||||
.replacingOccurrences(of: ">", with: ">")
|
||||
}
|
||||
|
||||
func percentDecoded() -> String {
|
||||
guard let decoded = removingPercentEncoding else {
|
||||
return self
|
||||
}
|
||||
return decoded
|
||||
}
|
||||
|
||||
var removingSurroundingQuotes: String {
|
||||
if hasPrefix("\"") && hasSuffix("\"") {
|
||||
return dropBeforeFirst("\"").dropAfterLast("\"")
|
||||
@ -85,6 +92,14 @@ extension String {
|
||||
func between(_ start: String, and end: String) -> String {
|
||||
dropBeforeFirst(start).dropAfterFirst(end)
|
||||
}
|
||||
|
||||
/**
|
||||
Split the string at the first occurence of the separator
|
||||
*/
|
||||
func splitAtFirst(_ separator: String) -> (String, String) {
|
||||
let parts = components(separatedBy: separator)
|
||||
return (parts.first!, parts.dropFirst().joined(separator: separator))
|
||||
}
|
||||
}
|
||||
|
||||
extension String {
|
||||
@ -129,4 +144,12 @@ extension Substring {
|
||||
func last(after: String) -> String {
|
||||
components(separatedBy: after).last!
|
||||
}
|
||||
|
||||
/**
|
||||
Split the string at the first occurence of the separator
|
||||
*/
|
||||
func splitAtFirst(_ separator: String) -> (String, String) {
|
||||
let parts = components(separatedBy: separator)
|
||||
return (parts.first!, parts.dropFirst().joined(separator: separator))
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user