操作符
!=(_:
!=(_:_:)
返回一個布爾值,指示兩個給定值是否不相等。
聲明
static func != <Other>(lhs: Self, rhs: Other) -> Bool where Other : BinaryInteger
參數
lhs
要比較的整數。
rhs
另一個要比較的整數。
詳述
您可以使用 not-equal-to 運算符 (!=
) 檢查任何 BinaryInteger
類型的實例的不等式。例如,您可以測試字符串的 UTF-8 編碼中的第一個 UInt8
值是否不等於其 Unicode 標量視圖中的第一個 UInt32
值:
let gameName = "Red Light, Green Light"
if let firstUTF8 = gameName.utf8.first,
let firstScalar = gameName.unicodeScalars.first?.value {
print("First code values are different: \(firstUTF8 != firstScalar)")
}
// Prints "First code values are different: false"
可用版本
iOS 8.0+, iPadOS 8.0+, macOS 10.10+, Mac Catalyst 13.0+, tvOS 9.0+, watchOS 2.0+
相關用法
- Swift UInt8 ~(_:)用法及代碼示例
- Swift UInt8 leadingZeroBitCount用法及代碼示例
- Swift UInt8 init(integerLiteral:)用法及代碼示例
- Swift UInt8 ..<(_:_:)用法及代碼示例
- Swift UInt8 *=(_:_:)用法及代碼示例
- Swift UInt8 multipliedFullWidth(by:)用法及代碼示例
- Swift UInt8 ^=(_:_:)用法及代碼示例
- Swift UInt8 init(clamping:)用法及代碼示例
- Swift UInt8 init(truncatingIfNeeded:)用法及代碼示例
- Swift UInt8 *(_:_:)用法及代碼示例
- Swift UInt8 trailingZeroBitCount用法及代碼示例
- Swift UInt8 +(_:)用法及代碼示例
- Swift UInt8 >>=(_:_:)用法及代碼示例
- Swift UInt8 >>(_:_:)用法及代碼示例
- Swift UInt8 |(_:_:)用法及代碼示例
- Swift UInt8 nonzeroBitCount用法及代碼示例
- Swift UInt8 ==(_:_:)用法及代碼示例
- Swift UInt8 &-=(_:_:)用法及代碼示例
- Swift UInt8 &<<(_:_:)用法及代碼示例
- Swift UInt8 init(exactly:)用法及代碼示例
- Swift UInt8 &=(_:_:)用法及代碼示例
- Swift UInt8 <<=(_:_:)用法及代碼示例
- Swift UInt8 -(_:_:)用法及代碼示例
- Swift UInt8 &(_:_:)用法及代碼示例
- Swift UInt8 %(_:_:)用法及代碼示例
注:本文由純淨天空篩選整理自apple.com大神的英文原創作品 UInt8 !=(_:_:)。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。