numfmt_set_pattern(3) php man page | unix.com

Man Page: numfmt_set_pattern

Operating Environment: php

Section: 3

NUMFMT_SET_PATTERN(3)							 1						     NUMFMT_SET_PATTERN(3)

NumberFormatter::setPattern - Set formatter pattern

	Object oriented style

SYNOPSIS
public bool NumberFormatter::setPattern (string $pattern)
DESCRIPTION
Procedural style bool numfmt_set_pattern (NumberFormatter $fmt, string $pattern) Set the pattern used by the formatter. Can not be used on a rule-based formatter.
PARAMETERS
o $fmt -NumberFormatter object. o $pattern - Pattern in syntax described in ICU DecimalFormat documentation.
RETURN VALUES
Returns TRUE on success or FALSE on failure.
EXAMPLES
Example #1 numfmt_set_pattern(3) example <?php $fmt = numfmt_create( 'de_DE', NumberFormatter::DECIMAL ); echo "Pattern: ".numfmt_get_pattern($fmt)." "; echo numfmt_format($fmt, 1234567.891234567890000)." "; numfmt_set_pattern($fmt, "#0.# kg"); echo "Pattern: ".numfmt_get_pattern($fmt)." "; echo numfmt_format($fmt, 1234567.891234567890000)." "; ?> Example #2 OO example <?php $fmt = new NumberFormatter( 'de_DE', NumberFormatter::DECIMAL ); echo "Pattern: ".$fmt->getPattern()." "; echo $fmt->format(1234567.891234567890000)." "; $fmt->setPattern("#0.# kg"); echo "Pattern: ".$fmt->getPattern()." "; echo $fmt->format(1234567.891234567890000)." "; ?> The above example will output: Pattern: #,##0.### 1.234.567,891 Pattern: #0.# kg 1234567,9 kg
SEE ALSO
numfmt_get_error_code(3), numfmt_create(3), numfmt_get_pattern(3). PHP Documentation Group NUMFMT_SET_PATTERN(3)
Related Man Pages
numfmt_format_currency(3) - php
numfmt_get_text_attribute(3) - php
numfmt_format(3) - php
numfmt_parse(3) - php
numberformatter.gettextattribute(3) - php
Similar Topics in the Unix Linux Community
Extract Pattern Sequence
SED Search Pattern and Replace with the Pattern
Pattern Replacement
Replace Text Based On Pattern
Formatting paragraphs with fmt with rule