We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent c9f2151 commit ec6911cCopy full SHA for ec6911c
Sources/InAnyCase/InAnyCase.swift
@@ -46,10 +46,12 @@ public enum JoinStyle: WordJoinStyle {
46
/// space case
47
case space
48
49
+ private static let camelSplitRegex = Regex("(?<!\\p{Lu})(?=\\p{Lu})")
50
+
51
public func split(_ string: Substring) -> [Substring] {
52
switch self {
53
case .camel:
- return String(string).split(by: Regex("(?<!\\p{Lu})(?=\\p{Lu})"))
54
+ return String(string).split(by: Self.camelSplitRegex)
55
case .snake:
56
return string.split(separator: "_")
57
case .kebab:
0 commit comments