Fetch all results starting with letter A #148

Closed
opened 2025-12-29 15:25:46 +01:00 by adam · 2 comments
Owner

Originally created by @matuslittva on GitHub (Jul 6, 2017).

Hello i want to write query to select all results starting with particular letter, but this where clause is not working:

Where("name like 'A%'")

What is the problem?

Originally created by @matuslittva on GitHub (Jul 6, 2017). Hello i want to write query to select all results starting with particular letter, but this where clause is not working: Where("name like 'A%'") What is the problem?
adam added the question label 2025-12-29 15:25:46 +01:00
adam closed this issue 2025-12-29 15:25:47 +01:00
Author
Owner

@JohnEstropia commented on GitHub (Jul 6, 2017):

@matuslittvaWhere clauses use NSPredicates internally, so you need to write

Where("%K BEGINSWITH %@", "name", "A")

There's a good cheat sheet here: http://nshipster.com/nspredicate/
(Under "String Comparisons")

@JohnEstropia commented on GitHub (Jul 6, 2017): @matuslittva`Where` clauses use `NSPredicate`s internally, so you need to write ```swift Where("%K BEGINSWITH %@", "name", "A") ``` There's a good cheat sheet here: http://nshipster.com/nspredicate/ (Under "String Comparisons")
Author
Owner

@matuslittva commented on GitHub (Jul 6, 2017):

@JohnEstropia thank you so much

@matuslittva commented on GitHub (Jul 6, 2017): @JohnEstropia thank you so much
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/CoreStore#148