如何在 Microsoft RMS 中将 XML 数据四舍五入到小数点后两位?
我需要将 xml 中的小数值四舍五入到小数点后两位。
例如,我需要将 23.4436 显示为 23.44。
您能为此建议一个解决方案吗?
我在 Microsoft RMS 收据中使用它来显示收据上的值。
I need to round off the decimal value to 2 decimal places in xml.
For example, I need to display 23.4436 as 23.44.
Can you please suggest a solution for this?
I am using this in Microsoft RMS receipts to display the value on the receipt.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
要回答这个问题,根据读取 XML 数据的工具,应该有某种方法将特定标签识别为数字并将其读取到小数位。
例如,在 XSLT 中,您可以使用“format-number”,如 W3 学校网站所示(也有能力尝试一下)。
应该做这项工作。 (感谢评论中的 Hatzi)
To answer the question as it stands, depending on the tool that's reading your XML data, there should be some way to identify particular tags as numbers and read them to decimal places.
In XSLT, for example, you'd use "format-number", as seen on the W3 schools site (also has the ability to try it out).
Should do the job. (Thanks to Hatzi in the comments)