Rails:是否有将逗号添加到大数的 rails 技巧? - Rails: Is there a rails trick to adding commas to large numbers?

问题:

Is there a way to have rails print out a number with commas in it?有没有办法让 rails 打印出一个带有逗号的数字?

For example, if I have a number 54000000.34, I can run <%= number.function %>, which would print out "54,000,000.34"例如,如果我有一个数字 54000000.34,我可以运行 <%= number.function %>,它会打印出“54,000,000.34”

thanks!谢谢!


解决方案:

参考一: https://en.stackoom.com/question/4WWh
参考二: https://stackoom.com/question/4WWh
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章