Skip to content

Commit 5ca3b97

Browse files
committed
Introduce a sanitizer
1 parent 1ee7d1d commit 5ca3b97

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
/// A type responsible for sanitizing the renderer output
2+
internal struct Sanitizer {
3+
4+
/// Strip a tag from a given string
5+
///
6+
/// - Parameters:
7+
/// - tag: The tag to remove
8+
/// - string: The string to remove it from
9+
///
10+
/// - Returns: The sanitized string
11+
internal func strip(_ tag: String, from string: String) -> String {
12+
13+
return string.replacingOccurrences(of: "<\(tag)>", with: "")
14+
.replacingOccurrences(of: "</\(tag)>", with: "")
15+
}
16+
}

0 commit comments

Comments
 (0)