PHP
downloads | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

 
Last updated: Fri, 29 Aug 2008

view this page in

NumberFormatter::parse

numfmt_parse

(No version information available, might be only in CVS)

NumberFormatter::parse -- numfmt_parse数値をパースする

説明

オブジェクト指向型

mixed NumberFormatter::parse ( string $value [, integer $type [, integer &$position ]] )

手続き型

mixed numfmt_parse ( NumberFormatter $fmt , string $value [, integer $type [, integer &$position ]] )

現在のフォーマット規則を使用して、文字列を数値にパースします。

パラメータ

fmt

NumberFormatter オブジェクト。

type

使用する フォーマット形式。デフォルトでは NumberFormatter::TYPE_DOUBLE を使用します。

position

文字列中でパースを開始する位置のオフセット。 結果を返す際に、この値はパース終了時のオフセットを保持します。

返り値

パースした数値、あるいはエラー時に FALSE を返します。

例1 numfmt_parse() の例

<?php
$fmt 
numfmt_create'de_DE'NumberFormatter::DECIMAL );
$num "1.234.567,891";
echo 
numfmt_parse($fmt$num)."\n";
echo 
numfmt_parse($fmt$numNumberFormatter::TYPE_INT32)."\n";
?>

例2 オブジェクト指向の例

<?php
$fmt 
= new NumberFormatter'de_DE'NumberFormatter::DECIMAL );
$num "1.234.567,891";
echo 
$fmt->parse($num)."\n";
echo 
$fmt->parse($numNumberFormatter::TYPE_INT32)."\n";
?>

上の例の出力は以下となります。

1234567.891
1234567


add a note add a note User Contributed Notes
NumberFormatter::parse
There are no user contributed notes for this page.

 
Last updated: Fri, 29 Aug 2008
 
 
show source | credits | sitemap | contact | advertising | mirror sites