Zend_Measure-Output.xml 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!-- Reviewed: no -->
  3. <!-- EN-Revision: 24249 -->
  4. <sect1 id="zend.measure.output">
  5. <title>計測値の出力</title>
  6. <para>
  7. 計測値は、さまざまな方法で出力できます。
  8. </para>
  9. <para>
  10. <link linkend="zend.measure.output.auto">自動的な出力</link>
  11. </para>
  12. <para>
  13. <link linkend="zend.measure.output.value">値の出力</link>
  14. </para>
  15. <para>
  16. <link linkend="zend.measure.output.unit">単位つきの出力</link>
  17. </para>
  18. <para>
  19. <link linkend="zend.measure.output.unit">ローカライズされた文字列での出力</link>
  20. </para>
  21. <sect2 id="zend.measure.output.auto">
  22. <title>自動的な出力</title>
  23. <para>
  24. <classname>Zend_Measure</classname> は、文字列の自動的な出力をサポートしています。
  25. <example id="zend.measure.output.auto.example-1">
  26. <title>自動的な出力</title>
  27. <programlisting language="php"><![CDATA[
  28. $locale = new Zend_Locale('de');
  29. $mystring = "1.234.567,89";
  30. $unit = new Zend_Measure_Length($mystring,
  31. Zend_Measure_Length::STANDARD,
  32. $locale);
  33. echo $unit;
  34. ]]></programlisting>
  35. </example>
  36. </para>
  37. <note>
  38. <title>計測値の出力</title>
  39. <para>
  40. 出力を行うには、単に
  41. <ulink url="http://www.php.net/manual/ja/function.echo.php">echo</ulink>
  42. あるいは
  43. <ulink url="http://www.php.net/manual/ja/function.print.php">print</ulink>
  44. を使用するだけです。
  45. </para>
  46. </note>
  47. </sect2>
  48. <sect2 id="zend.measure.output.value">
  49. <title>値の出力</title>
  50. <para>
  51. 計測値の値だけを出力するには <methodname>getValue()</methodname> を使用します。
  52. <example id="zend.measure.output.value.example-1">
  53. <title>値の出力</title>
  54. <programlisting language="php"><![CDATA[
  55. $locale = new Zend_Locale('de');
  56. $mystring = "1.234.567,89";
  57. $unit = new Zend_Measure_Length($mystring,
  58. Zend_Measure_Length::STANDARD,
  59. $locale);
  60. echo $unit->getValue();
  61. ]]></programlisting>
  62. </example>
  63. </para>
  64. <para>
  65. <methodname>getValue()</methodname> メソッドには、オプションのパラメータ
  66. <property>round</property> を指定できます。
  67. これは、出力結果の精度を設定するものです。標準の精度は '2' です。
  68. </para>
  69. </sect2>
  70. <sect2 id="zend.measure.output.unit">
  71. <title>単位つきの出力</title>
  72. <para>
  73. 関数 <methodname>getType()</methodname> は、現在の単位を返します。
  74. <example id="zend.measure.output.unit.example-1">
  75. <title>単位の出力</title>
  76. <programlisting language="php"><![CDATA[
  77. $locale = new Zend_Locale('de');
  78. $mystring = "1.234.567,89";
  79. $unit = new Zend_Measure_Weight($mystring,
  80. Zend_Measure_Weight::POUND,
  81. $locale);
  82. echo $unit->getType();
  83. ]]></programlisting>
  84. </example>
  85. </para>
  86. </sect2>
  87. <sect2 id="zend.measure.output.localized">
  88. <title>ローカライズされた文字列での出力</title>
  89. <para>
  90. 文字列を出力する際は、通常はユーザの国にあわせた書式にしたくなることでしょう。
  91. たとえば、"1234567.8" という値はドイツでは "1.234.567,8" と表します。
  92. この機能は、将来のリリースでサポートされる予定です。
  93. </para>
  94. </sect2>
  95. </sect1>
  96. <!--
  97. vim:se ts=4 sw=4 et:
  98. -->