开发者

NSString - convert number (e.g. "ONE") to digit (e.g. "1")

开发者 https://www.devze.com 2023-03-17 11:28 出处:网络
I\'d like to convert a number e.g. \"ONE\", \"TWO\", \"THREE\" to a digit value e.g. \"1\", \"2\", \"3\".

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消