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
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章