StandardComparator
Compares String
s using one of a fixed set of standard comparison algorithms.
- iOS
- 15.0+
- macOS
- 12.0+
- tvOS
- 15.0+
- watchOS
- 8.0+
struct StandardComparator
Compares String
s using one of a fixed set of standard comparison algorithms.
struct StandardComparator
sSS30FoundationInternationalizationE18StandardComparatorV
What are these?43AK8
import Swift
import FoundationInternationalization
@frozen struct String
A Unicode string value that is a collection of characters.
struct Comparator
A String
comparison performed using the given comparison options and locale.
protocol Decodable
A type that can decode itself from an external representation.
protocol Encodable
A type that can encode itself to an external representation.
protocol Equatable
A type that can be compared for value equality.
protocol Hashable : Equatable
A type that can be hashed into a Hasher
to produce an integer hash value.
protocol Sendable
@preconcurrency protocol SortComparator<Compared> : Hashable, Sendable
A comparison algorithm for a given type.
init(_ base: String.StandardComparator, order: SortOrder = .forward)
Create a StandardComparator
from the given StandardComparator
with the given new order
.
init(from decoder: any Decoder) throws
static let lexical: String.StandardComparator
Compares String
s lexically.
var order: SortOrder
func compare(_ lhs: String, _ rhs: String) -> ComparisonResult
func encode(to encoder: any Encoder) throws
func hash(into hasher: inout Hasher)
typealias Compared = String
static func != (lhs: Self, rhs: Self) -> Bool
Returns a Boolean value indicating whether two values are not equal.