PageRenderTime 47ms CodeModel.GetById 19ms RepoModel.GetById 0ms app.codeStats 0ms

/class/Plugin/Smarty/modifier.number_format.php

http://github.com/ethna/ethna
PHP | 26 lines | 8 code | 2 blank | 16 comment | 3 complexity | 2bdc805ed2c55c683eec81706aa67034 MD5 | raw file
Possible License(s): BSD-3-Clause
  1. <?php
  2. /**
  3. * smarty modifier:number_format()
  4. *
  5. * number_format()関数のwrapper
  6. *
  7. * sample:
  8. * <code>
  9. * {"12345"|number_format}
  10. * </code>
  11. * <code>
  12. * 12,345
  13. * </code>
  14. *
  15. * @param string $string フォーマット対象文字列
  16. * @return string フォーマット済み文字列
  17. */
  18. function smarty_modifier_number_format($string)
  19. {
  20. if ($string === "" || $string == null) {
  21. return "";
  22. }
  23. return number_format($string);
  24. }