## Zend_Locale_Format

Description

- license: New BSD License
- copyright: Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)

Located in /Zend/Locale/Format.php (line 39)

Method Summary
static string convertNumerals (string $input, $from, [string $to = null], string $locale)
static array getCorrectableDate (string $date, [string $format = null], [string|Zend_Locale $locale = null])
static array getDate (string $date, [string $format = null], [string|Zend_Locale $locale = null])
static string getDateFormat ([string|Zend_Locale $locale = null])
static float getFloat ( $input, [integer $precision = null], [string|Zend_Locale $locale = null], string $value)
static integer getInteger (string $input, [string|Zend_Locale $locale = null])
static integer|string getNumber (string $input, [integer $precision = null], [string|Zend_Locale $locale = null])
static array getTime (string $time, [string $format = null], [string|Zend_Locale $locale = null])
static string getTimeFormat ([string|Zend_Locale $locale = null])
static boolean isCorrectableDate (string $date, [string $format = null], [string|Zend_Locale $locale = null])
static boolean isDate (string $date, [string $format = null], [string|Zend_Locale $locale = null])
static boolean isFloat ( $value, [string|Zend_Locale $locale = null], string $input)
static boolean isInteger ( $value, [string|Zend_Locale $locale = null], string $input)
static boolean isNumber (string $input, [string|Zend_Locale $locale = null])
static boolean isTime (string $time, [string $format = null], [locale $locale = null])
static string toFloat (string $value, [integer $precision = null], [string|Zend_Locale $locale = null])
static string toInteger (string $value, [string|Zend_Locale $locale = null])
static string toNumber (string $value, [integer $precision = null], [string|Zend_Locale $locale = null])
static string toNumberFormat (string $value, [integer $format = null], [string|Zend_Locale $locale = null])
Methods
static convertNumerals (line 83)

Changes the numbers/digits within a given string from one script to another 'Decimal' representated the stardard numbers 0-9, if a script does not exist an exception will be thrown.

Examples for conversion from Arabic to Latin numerals: convertNumerals('١١٠ Tests', 'Arab'); -> returns '100 Tests' Example for conversion from Latin to Arabic numerals: convertNumerals('100 Tests', 'Latin', 'Arab'); -> returns '١١٠ Tests'

- return: Returns the converted input
- access: public
- throws: Zend_Locale_Exception

static string convertNumerals (string $input, $from, [string $to = null], string $locale)

- string $input: String to convert
- string $locale: Script to parse, see Zend_Locale->getScriptList() for details
- string $to: OPTIONAL Script to convert to
- $from

static getCorrectableDate (line 798)

Returns an array with the normalized date from an locale date

a input of 10.01.2006 without a $locale would return: array ('day' => 10, 'month' => 1, 'year' => 2006) The optional $locale parameter is only used to convert human readable day and month names to their numeric equivalents. Some forms of invalid dates are automatically fixed, such as a $date string where month and days are swapped, and one of the two is larger than 12, or when a month or larger than 31. However, such dates are often ambiguous, so the "fixed" results might not be truly fixed. If the date was "fixed", then the return array element "fixed" will contain a non-zero value.

- return: Possible array members: day, month, year, hour, minute, second, fixed, format
- access: public

static array getCorrectableDate (string $date, [string $format = null], [string|Zend_Locale $locale = null])

- string $date: Date string
- string $format: OPTIONAL Date type CLDR format to parse. Only single-letter codes (H, m, s, y, M, d), and MMMM and EEEE are supported.
- string|Zend_Locale $locale: OPTIONAL Locale of $number, possibly in string form (e.g. 'de_AT')

static getDate (line 770)

Returns an array with the normalized date from an locale date

a input of 10.01.2006 without a $locale would return: array ('day' => 10, 'month' => 1, 'year' => 2006) The optional $locale parameter is only used to convert human readable day and month names to their numeric equivalents.

- return: Possible array members: day, month, year, hour, minute, second, format
- access: public

static array getDate (string $date, [string $format = null], [string|Zend_Locale $locale = null])

- string $date: Date string
- string $format: OPTIONAL Date type CLDR format to parse. Only single-letter codes (H, m, s, y, M, d), and MMMM and EEEE are supported.
- string|Zend_Locale $locale: OPTIONAL Locale of $number, possibly in string form (e.g. 'de_AT')

static getDateFormat (line 746)

Returns the default date format for $locale.

- return: format
- access: public

static string getDateFormat ([string|Zend_Locale $locale = null])

- string|Zend_Locale $locale: OPTIONAL Locale of $number, possibly in string form (e.g. 'de_AT')

static getFloat (line 404)

Alias for getNumber

- access: public

static float getFloat ( $input, [integer $precision = null], [string|Zend_Locale $locale = null], string $value)

- string $value: Number to localize
- integer $precision: OPTIONAL Precision of the float value, not touched if null
- string|Zend_Locale $locale: OPTIONAL Locale for parsing
- $input

static getInteger (line 455)

Returns the first found integer from an string Parsing depends on given locale (grouping and decimal)

Examples for input: ' 2345.4356,1234' = 23455456 '+23,3452.123' = 233452 ' 12343 ' = 12343 '-9456km' = -9456 '0' = 0 '(-){0,1}(\d+(\.){0,1})*(\,){0,1})\d+'

- return: Returns the extracted number
- access: public

static integer getInteger (string $input, [string|Zend_Locale $locale = null])

- string $input: Input string to parse for numbers
- string|Zend_Locale $locale: OPTIONAL locale for parsing the number format

static getNumber (line 129)

Returns the first found number from an string Parsing depends on given locale (grouping and decimal)

Examples for input: ' 2345.4356,1234' = 23455456.1234 '+23,3452.123' = 233452.123 ' 12343 ' = 12343 '-9456km' = -9456 '0' = 0 '(-){0,1}(\d+(\.){0,1})*(\,){0,1})\d+' '١١٠ Tests' = 110 call: getNumber($string, 'Arab');

- return: Returns the extracted number
- access: public

static integer|string getNumber (string $input, [integer $precision = null], [string|Zend_Locale $locale = null])

- string $input: Input string to parse for numbers
- integer $precision: OPTIONAL Precision of a float value, not touched if null
- string|Zend_Locale $locale: OPTIONAL Locale for parsing the number format

static getTime (line 882)

Returns an array with 'hour', 'minute', and 'second' elements extracted from $time

according to the order described in $format. For a format of 'H:m:s', and an input of 11:20:55, getTime() would return: array ('hour' => 11, 'minute' => 20, 'second' => 55) The optional $locale parameter may be used to help extract times from strings containing both a time and a day or month name.

- return: Possible array members: day, month, year, hour, minute, second
- access: public

static array getTime (string $time, [string $format = null], [string|Zend_Locale $locale = null])

- string $time: Time string
- string $format: Date type CLDR format to parse. Only single-letter codes(H, m, s, y, M, d), and MMMM and EEEE are supported.
- string|Zend_Locale $locale: OPTIONAL Locale of $number, possibly in string form (e.g. 'de_AT')

static getTimeFormat (line 858)

Returns the default time format for $locale.

- return: format
- access: public

static string getTimeFormat ([string|Zend_Locale $locale = null])

- string|Zend_Locale $locale: OPTIONAL Locale of $number, possibly in string form (e.g. 'de_AT')

static isCorrectableDate (line 841)

Returns if the given string is a date

Some forms of invalid dates are automatically fixed, such as a $date string where month and days are swapped, and one of the two is larger than 12, or when a month or larger than 31. However, such dates are often ambiguous, so the "fixed" results might not be truly fixed.

- access: public

static boolean isCorrectableDate (string $date, [string $format = null], [string|Zend_Locale $locale = null])

- string $date: Date string
- string $format: Date type CLDR format to parse. Only single-letter codes (H, m, s, y, M, d), and MMMM and EEEE are supported.
- string|Zend_Locale $locale: OPTIONAL Locale for parsing the date string

static isDate (line 817)

Returns if the given string is a date

- access: public

static boolean isDate (string $date, [string $format = null], [string|Zend_Locale $locale = null])

- string $date: Date string
- string $format: Date type CLDR format to parse. Only single-letter codes (H, m, s, y, M, d), and MMMM and EEEE are supported.
- string|Zend_Locale $locale: OPTIONAL Locale for parsing the date string

static isFloat (line 433)

Returns if a float was found Alias for isNumber()

- return: Returns true if a number was found
- access: public

static boolean isFloat ( $value, [string|Zend_Locale $locale = null], string $input)

- string $input: Localized number string
- string|Zend_Locale $locale: OPTIONAL Locale for parsing
- $value

static isInteger (line 481)

Returns if a integer was found

- return: Returns true if a integer was found
- access: public

static boolean isInteger ( $value, [string|Zend_Locale $locale = null], string $input)

- string $input: Localized number string
- string|Zend_Locale $locale: OPTIONAL Locale for parsing
- $value

static isNumber (line 381)

Checks if the input contains a normalized or localized number

- return: Returns true if a number was found
- access: public

static boolean isNumber (string $input, [string|Zend_Locale $locale = null])

- string $input: Localized number string
- string|Zend_Locale $locale: OPTIONAL Locale for parsing

static isTime (line 900)

Returns is the given string is a time

- access: public

static boolean isTime (string $time, [string $format = null], [locale $locale = null])

- string $time: Time string
- string $format: Time type CLDR format !!!
- locale $locale: OPTIONAL Locale of time string

static toFloat (line 419)

Returns a locale formatted integer number Alias for toNumber()

- return: Locale formatted number
- access: public

static string toFloat (string $value, [integer $precision = null], [string|Zend_Locale $locale = null])

- string $value: Number to normalize
- integer $precision: OPTIONAL Precision of a float value, not touched if null
- string|Zend_Locale $locale: OPTIONAL Locale for parsing

static toInteger (line 468)

Returns a localized number

- return: Locale formatted number
- access: public

static string toInteger (string $value, [string|Zend_Locale $locale = null])

- string $value: Number to normalize
- string|Zend_Locale $locale: OPTIONAL Locale for parsing

static toNumber (line 184)

Returns a locale formatted number

- return: locale formatted number
- access: public

static string toNumber (string $value, [integer $precision = null], [string|Zend_Locale $locale = null])

- string $value: Number to localize
- integer $precision: OPTIONAL Precision of a float value, not touched if null or 0, -1 erased
- string|Zend_Locale $locale: OPTIONAL Locale for parsing

static toNumberFormat (line 234)

Returns a self formatted number

The seperation and fraction sign is used from the set locale ##0.# -> 12345.12345 -> 12345.12345 ##0.00 -> 12345.12345 -> 12345.12 ##,##0.00 -> 12345.12345 -> 12,345.12

- return: locale formatted number
- access: public

static string toNumberFormat (string $value, [integer $format = null], [string|Zend_Locale $locale = null])

- string $value: Number to localize
- integer $format: OPTIONAL Format to use
- string|Zend_Locale $locale: OPTIONAL Locale for parsing

Documentation generated on Wed, 21 Feb 2007 11:48:53 -0800 by phpDocumentor 1.3.1