Allow page id references with section

This commit is contained in:
Christoph Hagen
2023-07-28 13:59:08 +02:00
parent bd57c6fbf5
commit 2608e870cc
2 changed files with 11 additions and 3 deletions

View File

@ -56,6 +56,11 @@ extension String {
return parts.dropLast().joined(separator: separator) + content + separator + parts.last!
}
/**
Remove everything behind the first separator.
Also removes the separator itself. If the separator is not contained in the string, then the full string is returned.
*/
func dropAfterFirst<T>(_ separator: T) -> String where T: StringProtocol {
components(separatedBy: separator).first!
}