symfony API

sfNumberFormat Class

You are currently browsing
the website for symfony 1

Visit the Symfony2 website


« Back to API menu

1.1 API OpenSearch

Packages

You are currently browsing the symfony API for the 1.1 version. Switch to:
This version of symfony is not maintained anymore.
If some of your projects still use this version, consider upgrading as soon as possible.

sfNumberFormat class.

Method Summary

  • fixFloat()
  • string format($number, $pattern, $currency, $charset)
    Formats the number for a certain pattern. The valid patterns are
  • string formatDecimal($decimal)
    Formats the decimal places.
  • string formatInteger($string)
    Formats the integer, perform groupings and string padding.
  • string setPattern($pattern)
    Sets the pattern to format against. The default patterns
  • sfNumberFormat __construct($formatInfo)
    Creates a new number format instance. The constructor can be instantiated

Method Details

  • fixFloat () Browse code

  • (string) format ($number, $pattern, $currency, $charset) Browse code

    $number the number to format.
    $pattern the format pattern, either, 'c', 'd', 'e', 'p' or a custom pattern. E.g. "#.000" will format the number to 3 decimal places.
    $currency 3-letter ISO 4217 code. For example, the code "USD" represents the US Dollar and "EUR" represents the Euro currency.
    $charset The charset

    Formats the number for a certain pattern. The valid patterns are

    'c', 'd', 'e', 'p' or a custom pattern, such as "#.000" for
    3 decimal places.

    returns formatted number string

  • (string) formatDecimal ($decimal) Browse code

    $decimal the decimal number in string form.

    Formats the decimal places.

    returns formatted decimal places.

  • (string) formatInteger ($string) Browse code

    $string the decimal number in string form.

    Formats the integer, perform groupings and string padding.

    returns formatted integer string with grouping

  • (string) setPattern ($pattern) Browse code

    $pattern the requested patterns.

    Sets the pattern to format against. The default patterns

    are retrieved from the sfNumberFormatInfo instance.

    returns a number format pattern.

  • (sfNumberFormat) __construct ($formatInfo) Browse code

    $formatInfo either null, a sfCultureInfo, a sfNumberFormatInfo, or string

    Creates a new number format instance. The constructor can be instantiated

    with a string that represent a culture/locale. Similarly, passing
    a sfCultureInfo or sfNumberFormatInfo instance will instantiated a instance
    for that particular culture.