在 Java 中,如何将缩写整数转换为字符串中的整数?
我有以下字符串作为我的输入:
(100m/10k) * 10k
我
m = 1,000,000
k = 1,000
我期望
(100000000/10000) * 10000
很难弄清楚如何用“真实整数”替换缩写整数。我已经尝试循环浏览字符串中的每个字符,并找到具有相应整数的字母并将其与整数相乘,但是我在字母前找到整数很难,然后替换/插入它在正确的位置。
I have the following string as my input:
(100m/10k) * 10k
where
m = 1,000,000
k = 1,000
I expect an output of
(100000000/10000) * 10000
I'm having a difficult time figuring out how to replace the abbreviated integers with "real integers". I've tried looping through each of the characters in the string and finding the letters that have a corresponding integer and multiplying them with the integer before it, but I'm having trouble with finding the integer before the letter, and replacing/inserting it in the correct spot.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论