I wish you would have said something like "the user types 20
into the text field and I want the value to be 20".
But what you're describing sounds like something very application specific.
What I'd recommend doing is building a dictionary of words (as keys) and NSNumbers (objects) for their equivalents. If you're doing more than just numbers, you might want to store custom Objective C objects for key words.
Something like:
NSDictionary * myPhraseToNumberDictionary =
[[NSDictionary alloc] initWithObjectsAndKeys: [NSNumber numberWithInt: 20], @"mvg", [NSNumber numberWithInt: 40], @"dmvg", [NSNumber numberWithInt: 40], @"tmvg", nil]
So then when the user types in mvg
, parse through the text field and for each keyword hit in your dictionary, you'll get a NSNumber object containing the expected number back at you, which you can then use for calculating.