A nifty little code snippet has been posted by John Muchow.
What it does, by simply dropping in the given snippet into the delegate for the text field, is apply simple validation using an NSCharacterSet in which you define the unacceptable characters, and apply that on a string using the componentsSeparatedByCharactersInSet. A very nice and quick way for doing simple validation, and it will validate characters that you try pasting in the UITextField from the clipboard.
You can check out the code here at: Validate User Inputs In UITextField, With Smarts To Properly Manage Copy and Paste
Please post any comments below, Thanks.
[Source: iPhone Developer Tips]