logo
  • 教程列表
  • SO官方文檔
  • NSPredicate
    • 使用 NSPredicate 進行表單驗證
    • 使用 predicateWithBlock 建立 NSPredicate
    • 使用 predicateWithFormat 建立 NSPredicate
    • 使用替換變數建立 NSPredicate
    • 使用 NSPredicate 過濾陣列
    • NSPredicate 與 AND OR 和 NOT 條件
  1. StackOverflow 文件
  2. iOS 教程
  3. NSPredicate
  4. 使用 predicateWithFormat 建立 NSPredicate

使用 predicateWithFormat 建立 NSPredicate

Created: November-22, 2018

Objective-C

NSPredicate *predicate = [NSPredicate predicateWithFormat: @"self[SIZE] = %d", 5)];

迅速

let predicate = NSPredicate(format: "self[SIZE] >= %d", 5)

在此示例中,謂詞將匹配長度至少為 5 的陣列。

  • 使用替換變數建立 NSPredicate
  • 使用 predicateWithBlock 建立 NSPredicate

Copyright © 2018. All right reserved

tastones.com 备案号:鲁ICP备18045372号-1

  • 關於本站
  • 免責聲明