简体   繁体   中英

converting str to int and vice versa

I have a need to convert a string to an int and back after doing some processing. And the string has to be in words like below:

45 - forty five
99 - ninety nine

I searched everywhere for a hint but couldn't find any. I know the obvious switch-case logic but I am curious if theres a more intelligent way doing it with less lines of code.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM