I know that both ✭star and ♦ diamond are from the ASCII extended character set. But is there some NScharacterSet available on iOS that I can use to check for characters like these programmatically?
Asked
Active
Viewed 222 times
2 Answers
0
you can display these symbols using charsets ISO 8859-1 or UTF-8.
[ ★ ] star solid [ number: ★]
[ ♦ ] black diamond suit [name: ♦] [number: ♦]

Ravindra Bagale
- 17,226
- 9
- 43
- 70
0
This can be done with the NSString object method: rangeOfCharacterFromSet. It returns NSRange object.
From that,
Eg.:
NSCharacterSet *charSet = [[NSCharacterSet characterSetWithCharactersInString:@"0123456789"] invertedSet];
NSString *string = @"Stach✭Overflow";
NSRange range = [string rangeOfCharacterFromSet:charSet];
if(range.location != NSNotFound) {
// one of those characters is exists in the string.
}else{
//no specifiedcharacter not found.
}

Bharath
- 314
- 2
- 8