objective c - How can I find whether an exact sub string is present or not in NSString -


how can find whether exact substring present or not in nsstring.

currently assume string "1000 * roomtemperature" , want check whether "roomtemperature" present or not.

["1000 * roomtemperature" rangeofstring:"roomtemperature"].location != nsnotfound give me true. if check ["1000 * roomtemperature" rangeofstring:"temperature"].location != nsnotfound. return me true.

my requirement false second scenario. please me out solution.

try using following code. return true if word exist , false if not exist

nsstring *str =  @"1000 * roomtemperature"; nsarray *array = [str componentsseparatedbystring:@" "]; return [array containsobject:@"roomtemperature"]; 

Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -