示例#1
0
 /**
  * Format currency
  */
 public static function formatCurrencyString($str)
 {
     if (!$str) {
         return null;
     }
     $cfmt = CalemText::getCurrencyFormat();
     $pfmt = $cfmt['positive'];
     $rtn = number_format($str, $pfmt['decimal'], $pfmt['dsep'], $pfmt['ksep']);
     if ($str < 0) {
         $rtn = substr($rtn, 1, strlen($rtn) - 1);
         //remove '-'
         $nfmt = $cfmt['negative'];
         if ($nfmt['enclosed']) {
             $rtn = $nfmt['left'] . $rtn . $nfmt['right'];
         }
     }
     return $rtn;
 }