cvs: phpdoc-da /reference/strings/functions money-format.xml

From: Date: Fri, 23 Jul 2004 13:42:05 +0000
Subject: cvs: phpdoc-da /reference/strings/functions money-format.xml
Groups: php.doc.da 
Request: Send a blank email to doc-da+get-112@lists.php.net to get a copy of this message
holst Fri Jul 23 09:42:05 2004 EDT Added files: /phpdoc-da/reference/strings/functions money-format.xml Log: Initial translation

http://cvs.php.net/co.php/phpdoc-da/reference/strings/functions/money-format.xml?r=1.1&p=1 Index: phpdoc-da/reference/strings/functions/money-format.xml +++ phpdoc-da/reference/strings/functions/money-format.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <!-- EN-Revision: 1.7 Maintainer: holst Status: ready --> <refentry id="function.money-format"> <refnamediv> <refname>money_format</refname> <refpurpose>Formaterer et tal som en valutastreng</refpurpose> </refnamediv> <refsect1> <title>Beskrivelse</title> <methodsynopsis> <type>string</type><methodname>money_format</methodname> <methodparam><type>string</type><parameter>format</parameter></methodparam> <methodparam><type>float</type><parameter>number</parameter></methodparam> </methodsynopsis> <para> <function>money_format</function> returnerer en formateret version af <parameter>number</parameter>. Denne funktion ombryder C-funktionen <function>strfmon</function>, med den forskel at denne udførelse kun konverterer ét tal af gangen. </para> <note> <para> Funktionen <function>money_format</function> findes kun hvis systemet har strfmon-kabaliteter. For eksempel har Windows ikke, så <function>money_format</function> findes ikke på Windows. </para> </note> <para> Formatspecifikationen består af følgende rækkefølge: <itemizedlist> <listitem><para>a <literal>%</literal> tegn</para></listitem> <listitem><para>valgfrie flag</para></listitem> <listitem><para>valgfri feltbredde</para></listitem> <listitem><para>valgfri venstrepræcision</para></listitem> <listitem><para>valgfri højrepræcision</para></listitem> <listitem><para>et påkrævet konverteringstegn</para></listitem> </itemizedlist> </para> <formalpara> <title>Flags</title> <para> En eller flere af de valgfrie flags nedenfor kan bruges: <variablelist> <varlistentry> <term><literal>=</literal><replaceable>f</replaceable></term> <listitem> <para> Tegnet <literal>=</literal> efterfulgt af et a (enkelt byte) tegn <replaceable>f</replaceable> kan bruges som det numeriske udfyldningstegn. Standardtegnet er et mellemrum. </para> </listitem> </varlistentry> <varlistentry> <term><literal>^</literal></term> <listitem> <para> Disable the use of grouping characters (as defined by the current locale). </para> </listitem> </varlistentry> <varlistentry> <term><literal>+</literal> or <literal>(</literal></term> <listitem> <para> Specify the formatting style for positive and negative numbers. If <literal>+</literal> is used, the locale's equivalent for <literal>+</literal> and <literal>-</literal> will be used. If <literal>(</literal> is used, negative amounts are enclosed in parenthesis. If no specification is given, the default is <literal>+</literal>. </para> </listitem> </varlistentry> <varlistentry> <term><literal>!</literal></term> <listitem> <para> Suppress the currency symbol from the output string. </para> </listitem> </varlistentry> <varlistentry> <term><literal>-</literal></term> <listitem> <para> If present, it will make all fields left-justified (padded to the right), as opposed to the default which is for the fields to be right-justified (padded to the left). </para> </listitem> </varlistentry> </variablelist> </para> </formalpara> <formalpara> <title>Field width</title> <para> <variablelist> <varlistentry> <term><replaceable>w</replaceable></term> <listitem> <para> A decimal digit string specifying a minimum field width. Field will be right-justified unless the flag <literal>-</literal> is used. Default value is 0 (zero). </para> </listitem> </varlistentry> </variablelist> </para> </formalpara> <formalpara> <title>Left precision</title> <para> <variablelist> <varlistentry> <term><literal>#</literal><replaceable>n</replaceable></term> <listitem> <para> The maximum number of digits (<replaceable>n</replaceable>) expected to the left of the decimal character (e.g. the decimal point). It is used usually to keep formatted output aligned in the same columns, using the fill character if the number of digits is less than <replaceable>n</replaceable>. If the number of actual digits is bigger than <replaceable>n</replaceable>, then this specification is ignored. </para> <para> If grouping has not been suppressed using the <literal>^</literal> flag, grouping separators will be inserted before the fill characters (if any) are added. Grouping separators will not be applied to fill characters, even if the fill character is a digit. </para> <para> To ensure alignment, any characters appearing before or after the number in the formatted output such as currency or sign symbols are padded as necessary with space characters to make their positive and negative formats an equal length. </para> </listitem> </varlistentry> </variablelist> </para> </formalpara> <formalpara> <title> Right precision </title> <para> <variablelist> <varlistentry> <term><literal>.</literal><replaceable>p</replaceable></term> <listitem> <para> A period followed by the number of digits (<replaceable>p</replaceable>) after the decimal character. If the value of <replaceable>p</replaceable> is 0 (zero), the decimal character and the digits to its right will be omitted. If no right precision is included, the default will dictated by the current local in use. The amount being formatted is rounded to the specified number of digits prior to formatting. </para> </listitem> </varlistentry> </variablelist> </para> </formalpara> <formalpara> <title> Conversion characters </title> <para> <variablelist> <varlistentry> <term><literal>i</literal></term> <listitem> <para> The number is formatted according to the locale's international currency format (e.g. for the USA locale: USD 1,234.56). </para> </listitem> </varlistentry> <varlistentry> <term><literal>n</literal></term> <listitem> <para> The number is formatted according to the locale's national currency format (e.g. for the de_DE locale: DM1.234,56). </para> </listitem> </varlistentry> <varlistentry> <term><literal>%</literal></term> <listitem> <para> Returns the <literal>%</literal> character. </para> </listitem> </varlistentry> </variablelist> </para> </formalpara> <note> <para> The <constant>LC_MONETARY</constant> category of the locale settings, affects the behavior of this function. Use <function>setlocale</function> to set to the appropriate default locale before using this function. </para> <para> Characters before and after the formatting string will be returned unchanged. </para> </note> <para> <example> <title><function>money_format</function> Example</title> <para> We will use different locales and format specifications to illustrate the use of this function. </para> <programlisting role="php"> <![CDATA[ <?php $number = 1234.56; // let's print the international format for the en_US locale setlocale(LC_MONETARY, 'en_US'); echo money_format('%i', $number) . "\n"; // USD 1,234.56 // Italian national format with 2 decimals` setlocale(LC_MONETARY, 'it_IT'); echo money_format('%.2n', $number) . "\n"; // L. 1.234,56 // Using a negative number $number = -1234.5672; // US national format, using () for negative numbers // and 10 digits for left precision setlocale(LC_MONETARY, 'en_US'); echo money_format('%(#10n', $number) . "\n"; // ($ 1,234.57) // Similar format as above, adding the use of 2 digits of right // precision and '*' as a fill character echo money_format('%=*(#10.2n', $number) . "\n"; // ($********1,234.57) // Let's justify to the left, with 14 positions of width, 8 digits of // left precision, 2 of right precision, withouth grouping character // and using the international format for the de_DE locale. setlocale(LC_MONETARY, 'de_DE'); echo money_format('%=*^-14#8.2i', 1234.56) . "\n"; // DEM 1234,56**** // Let's add some blurb before and after the conversion specification setlocale(LC_MONETARY, 'en_GB'); $fmt = 'The final value is %i (after a 10%% discount)'; echo money_format($fmt, 1234.56) . "\n"; // The final value is GBP 1,234.56 (after a 10% discount) ?> ]]> </programlisting> </example> </para> <para> See also: <function>setlocale</function>, <function>number_format</function>,<function>sprintf</function>, <function>printf</function> and <function>sscanf</function>. </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 -->
« previous php.doc.da (#112) next »