Find if char is in line in lens c

I looked through the entire reference to the NSString class, but I can’t understand if I have a string, which method can I use to check if a specific character is inside the string.

For example, if my line

NSString * string = "123.32" if ([string hasString:@"."]) { //do stuff 

so I don’t really like the index in which it is located, but whether it has it or not :-)

+4
source share
1 answer

You want rangeOfString: - for example, [string rangeOfString:@"."].location != NSNotFound .

+8
source

Source: https://habr.com/ru/post/1390708/


All Articles