characterSetWithCharactersInString 写一个使用示例
NSString *letters = @"abcdefghijklmnopqrstuvwxyz"; NSCharacterSet *set = [NSCharacterSet characterSetWithCharactersInString:letters]; NSString *string = @"Hello World"; NSRange range = [string rangeOfCharacterFromSet:set]; if (range.location != NSNotFound) { NSLog(@"The string contains at least one letter from the set"); } else { NSLog(@"The string does not contain any letters from the set"); }
原文地址: https://www.cveoy.top/t/topic/bRTT 著作权归作者所有。请勿转载和采集!