iOS - Complex string comparisons using NSPredicate -
i need compare strings such conditions met. conditions not patterns can match using regex rather "expression" conditions.
for instance match string when number between 2 values:
inputstring = "the price of flight paris 550$ , tomorrow go 150$" matchingcondition = "the price of flight paris expression( 500 < x < 600)$ , tomorrow go expression(100 < y < 200)$"
i need run comparison on random texts don't input string in question.
i.e.
inputstring = "blah blah blah"
i able compare using simple true/false function. i.e.:
match(inputstring,matchingcondition) -> boolean
examples:
match(inputstring : "the price of flight 400$",matchingcondition : "the price of flight expression( 300$ < x < 401)$") -> true match(inputstring : "the price of flight 402$",matchingcondition : "the price of flight expression( 300$ < x < 401)$") -> false match(inputstring : "blah blah blah",matchingcondition : "the price of flight expression( 300$ < x < 401)$") -> false
is there way accomplish type of comparison (using nspredicate
example)
Comments
Post a Comment