cuốn sách gpt4 ai đã làm

按土耳其语言环境快速排序 FetchRequest 结果

In lại Tác giả: Walker 123 更新时间:2023-11-28 08:01:09 25 4
mua khóa gpt4 Nike

如何按土耳其语对 fetchResult 进行排序,土耳其语字符在结果末尾排序。

let managedObjectContext = (UIApplication.shared.delegate as! AppDelegate).managedObjectContext
let fetch = NSFetchRequest(entityName: "Contact")
let sortDescriptor = NSSortDescriptor(key: "firstName", ascending: true)
let sortDescriptors = [sortDescriptor]
fetch.sortDescriptors = sortDescriptors
do {
let list = try managedObjectContext.fetch(fetch)
} catch {
fatalError("Failed \(error)")
}

câu trả lời hay nhất

工作代码:

let managedObjectContext = (UIApplication.shared.delegate as! AppDelegate).managedObjectContext
let fetch = NSFetchRequest(entityName: "Contact")
let sortDescriptor = NSSortDescriptor(key: "firstName", ascending: true, selector: #selector(NSString.localizedCaseInsensitiveCompare))
let sortDescriptors = [sortDescriptor]
fetch.sortDescriptors = sortDescriptors
do {
let list = try managedObjectContext.fetch(fetch)
} catch {
fatalError("Failed \(error)")
}

关于按土耳其语言环境快速排序 FetchRequest 结果,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46660610/

25 4 0
Chứng chỉ ICP Bắc Kinh số 000000
Hợp tác quảng cáo: 1813099741@qq.com 6ren.com
Xem sitemap của VNExpress