将整数字符串转换为Money格式 [英] Converting Integer String to Money Format

查看:96
本文介绍了将整数字符串转换为Money格式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一组要更改为美国货币格式的整数.

I have a set of integers that I would like to change to a US money format.

以下是一些我想做的事的例子.第一个数字是数据库中的数字,第二个数字是我想要的货币格式.

Here are some examples of what I would like to do. The first number is what is in the database and the second is what I would like the money format to look like.

4500 = $ 45.00

4500 = $45.00

395 = $ 3.95

395 = $3.95

19000 = $ 190.00

19000 = $190.00

我真的只是不确定我应该使用什么功能来进行这种转换.

I'm really just unsure what function I should be using to make this sort of conversion.

感谢您的帮助

推荐答案

您可以使用还有 money_format(),但这有点更复杂.

There's also money_format(), but it's slightly more complicated.

这篇关于将整数字符串转换为Money格式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆