实例方法
localized
localizedCaseInsensitiveContains(_:)
返回一个布尔值,指示给定字符串是否为非空,并通过不区分大小写的非文字搜索包含在此字符串中,同时考虑到当前语言环境。
声明
func localizedCaseInsensitiveContains<T>(_ other: T) -> Bool where T : StringProtocol
详述
Locale-independent 不区分大小写操作和其他需求,可以通过调用 range(of:options:range:locale:)
来实现。
相当于:
range(of: other, options: .caseInsensitiveSearch,
locale: Locale.current) != nil
可用版本
iOS 8.0+, iPadOS 8.0+, macOS 10.10+, Mac Catalyst 13.0+, tvOS 9.0+, watchOS 2.0+
相关用法
- Swift StringProtocol hasPrefix(_:)用法及代码示例
- Swift StringProtocol hasSuffix(_:)用法及代码示例
- Swift String.UTF8View first用法及代码示例
- Swift String.UTF16View firstIndex(where:)用法及代码示例
- Swift String init()用法及代码示例
- Swift String.UTF16View last(where:)用法及代码示例
- Swift String.UnicodeScalarView flatMap(_:)用法及代码示例
- Swift String.UTF8View split(maxSplits:omittingEmptySubsequences:whereSeparator:)用法及代码示例
- Swift String init(_:radix:uppercase:)用法及代码示例
- Swift String.UTF8View elementsEqual(_:)用法及代码示例
- Swift String.UnicodeScalarView min(by:)用法及代码示例
- Swift String.UnicodeScalarView lastIndex(of:)用法及代码示例
- Swift String.UTF8View last(where:)用法及代码示例
- Swift String.Index ..<(_:_:)用法及代码示例
- Swift String.UTF8View split(separator:maxSplits:omittingEmptySubsequences:)用法及代码示例
- Swift String.UnicodeScalarView filter(_:)用法及代码示例
- Swift String.UTF8View debugDescription用法及代码示例
- Swift String init(cString:)用法及代码示例
- Swift String suffix(from:)用法及代码示例
- Swift String.UTF16View flatMap(_:)用法及代码示例
- Swift String removeAll(where:)用法及代码示例
- Swift String.UTF16View min(by:)用法及代码示例
- Swift String ...(_:_:)用法及代码示例
- Swift String last用法及代码示例
- Swift String contains(where:)用法及代码示例
注:本文由纯净天空筛选整理自apple.com大神的英文原创作品 StringProtocol localizedCaseInsensitiveContains(_:)。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。