Extend String methods to Substring
This commit is contained in:
@@ -3,9 +3,11 @@ protocol HBMustacheMethods {
|
||||
func runMethod(_ name: String) -> Any?
|
||||
}
|
||||
|
||||
extension String: HBMustacheMethods {
|
||||
extension StringProtocol {
|
||||
func runMethod(_ name: String) -> Any? {
|
||||
switch name {
|
||||
case "capitalized":
|
||||
return self.capitalized
|
||||
case "lowercased":
|
||||
return self.lowercased()
|
||||
case "uppercased":
|
||||
@@ -18,6 +20,9 @@ extension String: HBMustacheMethods {
|
||||
}
|
||||
}
|
||||
|
||||
extension String: HBMustacheMethods {}
|
||||
extension Substring: HBMustacheMethods {}
|
||||
|
||||
protocol HBComparableSequence {
|
||||
func runComparableMethod(_ name: String) -> Any?
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user