I want to check if a particular char I get from the text field lies between a particular hex range of unicode character set... Like if I enter capital C then I will specify the range 41-5a.. I want to do this for russian alphabet. But cant figure it out.I can get the last char entered using..
unichar lastEnteredChar= [[textField.text stringByReplacingCharactersInRange:range withString:string] characterAtIndex:[[textField.text stringByReplacingCharactersInRange:range withString:string] length] - 1];
but don't know where to go from here.
You can access a particular character in the
UITextField
like so:So if you want the last character:
Now
lastChar
is really just anunsigned short
, so you can compare it like so:Whether you want to constrain it to a hex range, or some other range, is up to you. I chose the examples you gave (41 thru 5a).