Back to index

php5  5.3.10
formatter_api.php
Go to the documentation of this file.
00001 <?php
00002 
00024 class NumberFormatter {
00025 #############################################################################
00026 # Common constants.
00027 #############################################################################
00028 
00029        /*
00030         * WARNING:
00031         * The values described here are NOT the actual values in PHP code.
00032         * They are references to the ICU C definitions, so the line
00033         *    const PATTERN_DECIMAL = 'UNUM_PATTERN_DECIMAL';
00034         * actually means that NumberFormatter::PATTERN_DECIMAL is the same as
00035         * UNUM_PATTERN_DECIMAL constant in the ICU library.
00036         */
00037 
00038        /*
00039         * These constants define formatter/parser argument type - integer, floating point or currency.
00040         */
00041        const TYPE_DEFAULT     = 'FORMAT_TYPE_DEFAULT';
00042        const TYPE_INT32       = 'FORMAT_TYPE_INT32';
00043        const TYPE_INT64       = 'FORMAT_TYPE_INT64';
00044        const TYPE_DOUBLE      = 'FORMAT_TYPE_DOUBLE';
00045        const TYPE_CURRENCY    = 'FORMAT_TYPE_CURRENCY';
00046 
00047        /*
00048         * UNumberFormatStyle constants
00049         */
00050        const PATTERN_DECIMAL   = 'UNUM_PATTERN_DECIMAL';
00051        const DECIMAL           = 'UNUM_DECIMAL';
00052        const CURRENCY          = 'UNUM_CURRENCY';
00053        const PERCENT           = 'UNUM_PERCENT';
00054        const SCIENTIFIC        = 'UNUM_SCIENTIFIC';
00055        const SPELLOUT          = 'UNUM_SPELLOUT';
00056        const ORDINAL           = 'UNUM_ORDINAL';
00057        const DURATION          = 'UNUM_DURATION';
00058        const PATTERN_RULEBASED = 'UNUM_PATTERN_RULEBASED';
00059        const DEFAULT           = 'UNUM_DEFAULT';
00060        const IGNORE            = 'UNUM_IGNORE';
00061 
00062        /*
00063         * UNumberFormatRoundingMode
00064         */
00065        const ROUND_CEILING  = 'UNUM_ROUND_CEILING';
00066        const ROUND_FLOOR    = 'UNUM_ROUND_FLOOR';
00067        const ROUND_DOWN     = 'UNUM_ROUND_DOWN';
00068        const ROUND_UP       = 'UNUM_ROUND_UP';
00069        const ROUND_HALFEVEN = 'UNUM_ROUND_HALFEVEN';
00070        const ROUND_HALFDOWN = 'UNUM_ROUND_HALFDOWN';
00071        const ROUND_HALFUP   = 'UNUM_ROUND_HALFUP';
00072 
00073        /*
00074         * UNumberFormatPadPosition
00075         */
00076        const PAD_BEFORE_PREFIX = 'UNUM_PAD_BEFORE_PREFIX';
00077        const PAD_AFTER_PREFIX  = 'UNUM_PAD_AFTER_PREFIX';
00078        const PAD_BEFORE_SUFFIX = 'UNUM_PAD_BEFORE_SUFFIX';
00079        const PAD_AFTER_SUFFIX  = 'UNUM_PAD_AFTER_SUFFIX';
00080 
00081        /*
00082         * UNumberFormatAttribute
00083         */
00084        const PARSE_INT_ONLY          = 'UNUM_PARSE_INT_ONLY';
00085        const GROUPING_USED           = 'UNUM_GROUPING_USED';
00086        const DECIMAL_ALWAYS_SHOWN    = 'UNUM_DECIMAL_ALWAYS_SHOWN';
00087        const MAX_INTEGER_DIGITS      = 'UNUM_MAX_INTEGER_DIGITS';
00088        const MIN_INTEGER_DIGITS      = 'UNUM_MIN_INTEGER_DIGITS';
00089        const INTEGER_DIGITS          = 'UNUM_INTEGER_DIGITS';
00090        const MAX_FRACTION_DIGITS     = 'UNUM_MAX_FRACTION_DIGITS';
00091        const MIN_FRACTION_DIGITS     = 'UNUM_MIN_FRACTION_DIGITS';
00092        const FRACTION_DIGITS         = 'UNUM_FRACTION_DIGITS';
00093        const MULTIPLIER              = 'UNUM_MULTIPLIER';
00094        const GROUPING_SIZE           = 'UNUM_GROUPING_SIZE';
00095        const ROUNDING_MODE           = 'UNUM_ROUNDING_MODE';
00096        const ROUNDING_INCREMENT      = 'UNUM_ROUNDING_INCREMENT';
00097        const FORMAT_WIDTH            = 'UNUM_FORMAT_WIDTH';
00098        const PADDING_POSITION        = 'UNUM_PADDING_POSITION';
00099        const SECONDARY_GROUPING_SIZE = 'UNUM_SECONDARY_GROUPING_SIZE';
00100        const SIGNIFICANT_DIGITS_USED = 'UNUM_SIGNIFICANT_DIGITS_USED';
00101        const MIN_SIGNIFICANT_DIGITS  = 'UNUM_MIN_SIGNIFICANT_DIGITS';
00102        const MAX_SIGNIFICANT_DIGITS  = 'UNUM_MAX_SIGNIFICANT_DIGITS';
00103        const LENIENT_PARSE           = 'UNUM_LENIENT_PARSE';
00104 
00105        /*
00106         * UNumberFormatTextAttribute
00107         */
00108        const POSITIVE_PREFIX   = 'UNUM_POSITIVE_PREFIX';
00109        const POSITIVE_SUFFIX   = 'UNUM_POSITIVE_SUFFIX';
00110        const NEGATIVE_PREFIX   = 'UNUM_NEGATIVE_PREFIX';
00111        const NEGATIVE_SUFFIX   = 'UNUM_NEGATIVE_SUFFIX';
00112        const PADDING_CHARACTER = 'UNUM_PADDING_CHARACTER';
00113        const CURRENCY_CODE     = 'UNUM_CURRENCY_CODE';
00114        const DEFAULT_RULESET   = 'UNUM_DEFAULT_RULESET';
00115        const PUBLIC_RULESETS   = 'UNUM_PUBLIC_RULESETS';
00116 
00117        /*
00118         * UNumberFormatSymbol
00119         */
00120        const DECIMAL_SEPARATOR_SYMBOL           = 'UNUM_DECIMAL_SEPARATOR_SYMBOL';
00121        const GROUPING_SEPARATOR_SYMBOL          = 'UNUM_GROUPING_SEPARATOR_SYMBOL';
00122        const PATTERN_SEPARATOR_SYMBOL           = 'UNUM_PATTERN_SEPARATOR_SYMBOL';
00123        const PERCENT_SYMBOL                     = 'UNUM_PERCENT_SYMBOL';
00124        const ZERO_DIGIT_SYMBOL                  = 'UNUM_ZERO_DIGIT_SYMBOL';
00125        const DIGIT_SYMBOL                       = 'UNUM_DIGIT_SYMBOL';
00126        const MINUS_SIGN_SYMBOL                  = 'UNUM_MINUS_SIGN_SYMBOL';
00127        const PLUS_SIGN_SYMBOL                   = 'UNUM_PLUS_SIGN_SYMBOL';
00128        const CURRENCY_SYMBOL                    = 'UNUM_CURRENCY_SYMBOL';
00129        const INTL_CURRENCY_SYMBOL               = 'UNUM_INTL_CURRENCY_SYMBOL';
00130        const MONETARY_SEPARATOR_SYMBOL          = 'UNUM_MONETARY_SEPARATOR_SYMBOL';
00131        const EXPONENTIAL_SYMBOL                 = 'UNUM_EXPONENTIAL_SYMBOL';
00132        const PERMILL_SYMBOL                     = 'UNUM_PERMILL_SYMBOL';
00133        const PAD_ESCAPE_SYMBOL                  = 'UNUM_PAD_ESCAPE_SYMBOL';
00134        const INFINITY_SYMBOL                    = 'UNUM_INFINITY_SYMBOL';
00135        const NAN_SYMBOL                         = 'UNUM_NAN_SYMBOL';
00136        const SIGNIFICANT_DIGIT_SYMBOL           = 'UNUM_SIGNIFICANT_DIGIT_SYMBOL';
00137        const MONETARY_GROUPING_SEPARATOR_SYMBOL = 'UNUM_MONETARY_GROUPING_SEPARATOR_SYMBOL';
00138 
00150        public function __construct($locale, $style, $pattern = null) {}
00151 
00168        public static function create($locale, $style, $pattern = null) {}
00169 
00183        public function format($number, $type = 0) {}
00184 
00196        public function parse($string, $type, &$position) {}
00197 
00206        public function formatCurrency($number, $currency) {}
00207 
00221        public function parseCurrency($string, &$currency, &$position) {}
00222 
00234        public function setAttribute($attr, $value) {}
00246        public function setTextAttribute($attr, $value) {}
00258        public function setSymbol($attr, $value) {}
00269        public function setPattern($pattern) {}
00276        public function getAttribute($attr) {}
00283        public function getTextAttribute($attr) {}
00290        public function getSymbol($attr) {}
00301        public function getPattern() {}
00308        public function getLocale($type = 0) {}
00316        public function getErrorCode() {}
00322        public public function getErrorMessage() {}
00323 
00324 }
00325 
00339 function numfmt_create($locale, $style, $pattern = null) {}
00353 function numfmt_format($formatter, $number, $type = null) {}
00366 function numfmt_parse($formatter, $string, $type, &$position) {}
00376 function numfmt_format_currency($formatter, $number, $currency) {}
00389 function numfmt_parse_currency($formatter, $string, &$currency, &$position) {}
00402 function numfmt_set_attribute($formatter, $attribute, $value) {}
00415 function numfmt_set_text_attribute($formatter, $attribute, $value) {}
00428 function numfmt_set_symbol($formatter, $attribute, $value) {}
00440 function numfmt_set_pattern($formatter, $pattern) {}
00448 function numfmt_get_attribute($formatter, $attribute) {}
00456 function numfmt_get_text_attribute($formatter, $attribute) {}
00464 function numfmt_get_symbol($formatter, $attribute) {}
00476 function numfmt_get_pattern($formatter) {}
00484 function numfmt_get_locale($formatter, $type = 0) {}
00493 function numfmt_get_error_code($formatter) {}
00500 function numfmt_get_error_message($formatter) {}