Skip to content

Commit f4ec3d6

Browse files
committed
use String.indicies instead of String(contains:)
remove another Foundation dependency
1 parent a146f83 commit f4ec3d6

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Sources/SwiftOCA/OCC/ControlDataTypes/SearchDataTypes.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,13 @@ package extension OcaStringComparisonType {
3737
case .substring:
3838
lhs.hasPrefix(rhs)
3939
case .contains:
40-
lhs.contains(rhs)
40+
lhs.indices.contains { lhs[$0...].hasPrefix(rhs) }
4141
case .exactCaseInsensitive:
4242
lhs.lowercased() == rhs.lowercased()
4343
case .substringCaseInsensitive:
4444
lhs.lowercased().hasPrefix(rhs.lowercased())
4545
case .containsCaseInsensitive:
46-
lhs.lowercased().contains(rhs.lowercased())
46+
lhs.lowercased().indices.contains { lhs.lowercased()[$0...].hasPrefix(rhs.lowercased()) }
4747
}
4848
}
4949
}

0 commit comments

Comments
 (0)