NumberFormat
class NumberFormat extends Format (View source)
Constants
TYPE |
|
Properties
string | $decimalSymbol | Character to use as the decimal marker. | |
int | $fractionDigits | How many digits to display after the decimal. | |
string | $groupingSymbol | Character to be used to group digits. | |
string | $negativeColor | Text color for negative values. | |
boolean | $negativeParens | Indicates that negative values should be surrounded by parentheses | |
string | $pattern | Format string, as a subset of the ICU pattern set. | |
string | $prefix | prefix to assign to values in the visualization. | |
string | $suffix | suffix to assign to values in the visualization. |
Methods
Builds the NumberFormat object with specified options
Same as toArray, but without the class name as a key to being multi-dimension.
Sets the character to use as the decimal marker. The default is a dot (.)
A number specifying how many digits to display after the decimal.
A character to be used to group digits to the left of the decimal into sets of three.
The text color for negative values. No default value.
Sets whether negative values should be surrounded by parentheses.
A format string. When provided, all other options are ignored, except negativeColor.
Sets the string prefix for the value.
Sets the string suffix for the value.
Details
at line 91
mixed
__construct(
array $config = array())
Builds the NumberFormat object with specified options
in
Format at line 79
array
getValues()
Same as toArray, but without the class name as a key to being multi-dimension.
in
Format at line 97
string
toJson()
Returns a JSON string representation of the object's properties.
at line 103
NumberFormat
decimalSymbol(
string $ds)
Sets the character to use as the decimal marker. The default is a dot (.)
at line 127
NumberFormat
fractionDigits(
int $fd)
A number specifying how many digits to display after the decimal.
The default is 2. If you specify more digits than the number contains, it will display zeros for the smaller values. Truncated values will be rounded (5 rounded up).
at line 149
NumberFormat
groupingSymbol(
string $gs)
A character to be used to group digits to the left of the decimal into sets of three.
Default is a comma (,)
at line 171
NumberFormat
negativeColor(
string $nc)
The text color for negative values. No default value.
Values can be any acceptable HTML color value, such as "red" or "#FF0000".
at line 193
NumberFormat
negativeParens(
boolean $np)
Sets whether negative values should be surrounded by parentheses.
Default is true.
at line 219
NumberFormat
pattern(
string $p)
A format string. When provided, all other options are ignored, except negativeColor.
The format string is a subset of the ICU pattern set. For instance, {pattern:'#,###%'} will result in output values "1,000%", "750%", and "50%" for values 10, 7.5, and 0.5.
at line 240
NumberFormat
prefix(
string $p)
Sets the string prefix for the value.
at line 261
NumberFormat
suffix(
string $s)
Sets the string suffix for the value.