Class 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 array getDate (string $date, [string $format = null], [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 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 toNumberSystem (string $input,  $from, [string $to = null], string $locale)
Methods
static getDate (line 617)

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
  • access: public
static array getDate (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 of $number, possibly in string form (e.g. 'de_AT')
static getFloat (line 312)

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 363)

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 122)

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+'

  • 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 665)

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 isDate (line 640)

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 341)

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 389)

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 289)

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 689)

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 327)

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 376)

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 176)

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
  • string|Zend_Locale $locale: OPTIONAL Locale for parsing
static toNumberSystem (line 80)

Changes the numbers/digits within a given string from one script to another When a script is not supported, no action is taken, so the original input will be returned So this function works the same way like translating

Examples for input: toNumberSystem('١١٠ Tests', 'Arab'); -> returns '100 Tests' Example for not supported script toNumberSystem('١١٠ Tests', 'Unkn'); -> returns '١١٠ Tests'

  • return: Returns the converted input
  • access: public
static string toNumberSystem (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

Documentation generated on Thu, 18 Jan 2007 09:54:08 -0800 by phpDocumentor 1.3.1