Swift

StringZilla for Swift

STRINGZILLA_SWIFT_ARTIFACT=build_swift/StringZillaC.xcframework swift test 6.0.0-rc.1 · 91a27bdd

Its SIMD-accelerated string kernels are built directly on the C core, so the same search, comparison, hashing, and Unicode-aware methods work identically on Linux servers and embedded targets as they do on macOS, iOS, tvOS, watchOS, and visionOS. There is no dependency on Foundation, Darwin, or any Apple-only runtime, which keeps binaries small and portable.

The package adds these methods directly to String, String.UTF8View, and Substring.UTF8View, all operating on the underlying UTF-8 bytes without intermediate copies. The one exception is a lazily bridged NSString, whose UTF-8 bytes are not contiguous, so each call copies them first. All operations are exposed through the StringZillaViewable protocol, which every supported string type conforms to. Search methods return native Swift String.Index values or a Range<Index>, so results splice cleanly back into your strings.

Topics

InstallationAdd StringZilla as a Swift Package Manager dependency in your Package.swift.
Types35
Searching and CountingSubstring search returns the Index?
Comparison and Equality1Comparisons are SIMD-accelerated and return a StringZillaOrdering of .ascending, .equal, or .descending, or a Bool.
Unicode SegmentationThese methods return byte-accurate [Range<Index>] arrays you can subscript back into the source string.
Case Folding and Normalization7utf8UncasedFind(substring:) performs a case-insensitive search using full Unicode folding and returns a byte-accurate Range<Index>?.
Hashing and Checksums12hash(seed:) computes a fast 64-bit UInt64 hash of the content, with an optional seed.
Runtime Dispatch41