NSString - convert number (e.g. "ONE") to digit (e.g. "1")
I'd like to convert a number e.g. "ONE", "TWO", "THREE" to a digit value e.g. "1", "2", "3".
I can easily do this for my limited subset of num开发者_JS百科bers by doing something like
if([number isEqualToString:@"ONE") return @"1";
but this doesn't strike me as a very efficient, robust or succinct approach.
I found this text: Method for the Natural Language Recognition of Numbers. It's exactly you want and is very precise. But, I didn't found codes. You can search more or ask to author for the algorithm.
精彩评论