Hi i just working of Validation of UITextFiled
For checking that it Starting with WhiteSpace. For Example I am Enter City name New York
In UITextFild like Bellow Image:-
as above TextFiled
Contain 6 blank space Before New York
. so i want to check that User can not Enter Add white-space Before Word but it allow to Enterd black space of Sentence between two word.
I am using Bellow code for checking white-space.
NSCharacterSet *whitespace = [NSCharacterSet whitespaceAndNewlineCharacterSet];
NSRange range =[txtCityName.text rangeOfCharacterFromSet:whitespace];
if(range.location != NSNotFound )
{
NSLog(@"hi ==%@",Whitespace Found);
}
else
{
NSLog(@"hi ==%@",Whitespace Not Found);
}
Above Code Check Full TextFiled
Text contain white-space or not, But I want to check only Starting of Sentence and also Check After end Of sentence it contain white-space or not.