Should work fine
This commit is contained in:
@@ -1,12 +0,0 @@
|
||||
import Foundation
|
||||
|
||||
extension String {
|
||||
public func camelCaseToSnakeCase() -> String {
|
||||
let pattern = "([a-z0-9])([A-Z])"
|
||||
let regex = try! NSRegularExpression(pattern: pattern, options: [])
|
||||
let range = NSRange(location: 0, length: self.count)
|
||||
return regex.stringByReplacingMatches(
|
||||
in: self, options: [], range: range, withTemplate: "$1_$2"
|
||||
).lowercased()
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user