Add single file audio player, introduce blocks

This commit is contained in:
Christoph Hagen
2025-01-06 01:17:06 +01:00
parent c78c359819
commit 245534e989
27 changed files with 521 additions and 88 deletions

View File

@ -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))
}
}