Query: numfmt_set_text_attribute
OS: php
Section: 3
Format: Original Unix Latex Style Formatted with HTML and a Horizontal Scroll Bar
NUMFMT_SET_TEXT_ATTRIBUTE(3) 1 NUMFMT_SET_TEXT_ATTRIBUTE(3) NumberFormatter::setTextAttribute - Set a text attribute Object oriented styleSYNOPSISpublic bool NumberFormatter::setTextAttribute (int $attr, string $value)DESCRIPTIONProcedural style bool numfmt_set_text_attribute (NumberFormatter $fmt, int $attr, string $value) Set a text attribute associated with the formatter. An example of a text attribute is the suffix for positive numbers. If the formatter does not understand the attribute, U_UNSUPPORTED_ERROR error is produced. Rule-based formatters only understand NumberFormat- ter::DEFAULT_RULESET and NumberFormatter::PUBLIC_RULESETS.PARAMETERSo $fmt -NumberFormatter object. o $attr - Attribute specifier - one of the text attribute constants. o $value - Text for the attribute value.RETURN VALUESReturns TRUE on success or FALSE on failure.EXAMPLESExample #1 numfmt_set_text_attribute(3) example <?php $fmt = numfmt_create( 'de_DE', NumberFormatter::DECIMAL ); echo "Prefix: ".numfmt_get_text_attribute($fmt, NumberFormatter::NEGATIVE_PREFIX)." "; echo numfmt_format($fmt, -1234567.891234567890000)." "; numfmt_set_text_attribute($fmt, NumberFormatter::NEGATIVE_PREFIX, "MINUS"); echo "Prefix: ".numfmt_get_text_attribute($fmt, NumberFormatter::NEGATIVE_PREFIX)." "; echo numfmt_format($fmt, -1234567.891234567890000)." "; ?> Example #2 OO example <?php $fmt = new NumberFormatter( 'de_DE', NumberFormatter::DECIMAL ); echo "Prefix: ".$fmt->getTextAttribute(NumberFormatter::NEGATIVE_PREFIX)." "; echo $fmt->format(-1234567.891234567890000)." "; $fmt->setTextAttribute(NumberFormatter::NEGATIVE_PREFIX, "MINUS"); echo "Prefix: ".$fmt->getTextAttribute(NumberFormatter::NEGATIVE_PREFIX)." "; echo $fmt->format(-1234567.891234567890000)." "; ?> The above example will output: Prefix: - -1.234.567,891 Prefix: MINUS MINUS1.234.567,891SEE ALSOnumfmt_get_error_code(3), numfmt_get_text_attribute(3), numfmt_set_attribute(3). PHP Documentation Group NUMFMT_SET_TEXT_ATTRIBUTE(3)
Related Man Pages |
---|
numfmt_format_currency(3) - php |
numfmt_get_text_attribute(3) - php |
datefmt_is_lenient(3) - php |
msgfmt_set_pattern(3) - php |
numberformatter.gettextattribute(3) - php |
Similar Topics in the Unix Linux Community |
---|
How to add numbers? |
wc -c |
is it possible to echo 'some text' every 10 minutes on my screen |
Text Matching |
print ODD lines |