公式字段中的数字到字符串
我正在使用公式字段来连接由破折号分隔的 2 个小数值。 但是,我希望结果修剪两个值的所有不必要的尾随零和小数点。
例如,我希望值 10 和 8.5 为“10 - 8.5”。 现在显示“10.00 - 8.50”。
我使用的公式是CSTR({field1}) + " - " + CSTR({field2})。
I am using a formula field to concatonate 2 decimal values separated by a dash. However, I want the result to trim all unneccesary trailing zeros and decimal points for both values.
For example, I want values 10 and 8.5 to be "10 - 8.5". Now it shows "10.00 - 8.50".
The formula I am using is CSTR({field1}) + " - " + CSTR({field2}).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我相信这就是您正在寻找的:
将十进制数字转换为仅显示非零小数的文本
特别是这一行可能会有所帮助:
第一个参数是要转换的小数,第二个参数是小数位数,第三个参数是千/百万等的分隔符。
I believe this is what you're looking for:
Convert Decimal Numbers to Text showing only the non-zero decimals
Especially this line might be helpful:
The first parameter is the decimal to be converted, the second parameter is the number of decimal places and the third parameter is the separator for thousands/millions etc.
第二个占位符用于小数。
最后一个占位符用于千位分隔符。
The second placeholder is for decimals.
The last placeholder is for thousands separator.
我为此编写了一个简单的函数:
i wrote a simple function for this: