objective c - how to find out is a long string contatins a word obj c, iphone -
i have long string has running list of "words entered" in text box. want able check long string against 1 word string see if long string contains word in short string.
any ideas?
i've tried , few other things, newstring long string , currenttextrightnow short string.
textrange =[newstring rangeofstring:currenttextrightnow]; nslog(@"currenttextright %@", currenttextrightnow); if(textrange.location != nsnotfound) { nslog(@"does contatin substring"); }
i had same problem did. doing right (if textrange of type nsrange) problem nsnotfound doesn't work expected (might bug). instead can do
if (range.length > 0) { //it found } else { // didn't find }
hope helps.
Comments
Post a Comment