objective c - How to detect space, and special characters like :, ?,`,~, etc in text of a textfield in iPhone SDK? -
how detect space, , special characters :, ?,`,~, etc in text of textfield in iphone sdk?
try this..
nscharacterset* symbols = [nscharacterset symbolcharacterset]; if([symbols characterismember: yourcharacter]) { //check condition here }
if want include many characters use combined nscharacterset nsmutablecharacterset..
nsmutablecharacterset *space = [nsmutablecharacterset charactersetwithcharactersinstring:@" "]; [space formunionwithcharacterset:[nscharacterset symbolcharacterset]];
use space characterset check character
Comments
Post a Comment