cvs: phpdoc-da /reference/strings/functions sprintf.xml
[email protected] ("Jonathan Holst")
| Newsgroups | php.doc.da |
|---|---|
| Message-ID | <cvsholst1090594873@cvsserver> |
holst Fri Jul 23 11:01:13 2004 EDT
Modified files:
/phpdoc-da/reference/strings/functions sprintf.xml
Log:
Translated rest of the file
holst-20040723110113.txt
(text/plain, 9.5 KB)
http://cvs.php.net/diff.php/phpdoc-da/reference/strings/functions/sprintf.xml?r1=1.1&r2=1.2&ty=u
Index: phpdoc-da/reference/strings/functions/sprintf.xml
diff -u phpdoc-da/reference/strings/functions/sprintf.xml:1.1 phpdoc-da/reference/strings/functions/sprintf.xml:1.2
--- phpdoc-da/reference/strings/functions/sprintf.xml:1.1 Fri Jul 23 09:41:26 2004
+++ phpdoc-da/reference/strings/functions/sprintf.xml Fri Jul 23 11:01:13 2004
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
-<!-- $Revision: 1.1 $ -->
+<!-- $Revision: 1.2 $ -->
<!-- EN-Revision: 1.9 Maintainer: holst Status: ready -->
<refentry id="function.sprintf">
<refnamediv>
@@ -24,13 +24,6 @@
<emphasis>konverteringsspecifikationer</emphasis>, hvert resulterer i at
fange dets eget parameter. Dette gælder for både
<function>sprintf</function> og <function>printf</function>.
-
- The format string is composed of zero or more directives:
- ordinary characters (excluding <literal>%</literal>) that are
- copied directly to the result, and <emphasis>conversion
- specifications</emphasis>, each of which results in fetching its
- own parameter. This applies to both <function>sprintf</function>
- and <function>printf</function>.
</simpara>
<para>
Hver konverteringspecifikation består af et procenttegn
@@ -73,55 +66,51 @@
</listitem>
<listitem>
<para>
- A <emphasis>type specifier</emphasis> that says what type the
- argument data should be treated as. Possible types:
+ En <emphasis>type specificerer</emphasis> som fortæller hvilken type
+ parameterdataene skal behandles som. Mulige typer:
<simplelist>
<member>
- <literal>%</literal> - a literal percent character. No
- argument is required.
+ <literal>%</literal> - et procenttegn. Intet parameter er påkrævet.
</member>
<member>
- <literal>b</literal> - the argument is treated as an
- integer, and presented as a binary number.
+ <literal>b</literal> - parametret bliver behandlet som et heltal og
+ præsenteret som et binært tal.
</member>
<member>
- <literal>c</literal> - the argument is treated as an
- integer, and presented as the character with that ASCII
- value.
+ <literal>c</literal> - parametret bliver behandlet som et heltal og
+ præsenteret som et tegn med den ASCII-værdi.
</member>
<member>
- <literal>d</literal> - the argument is treated as an
- integer, and presented as a (signed) decimal number.
+ <literal>d</literal> - parametret bliver behandlet som et heltal og
+ præsenteret som et (signeret) decimaltal.
</member>
<member>
- <literal>e</literal> - the argument is treated as scientific
- notation (e.g. 1.2e+2).
+ <literal>e</literal> - parametret bliver behandlet som et
+ videnskabeligt tegnsystem (eks. 1.2e+2).
</member>
<member>
- <literal>u</literal> - the argument is treated as an
- integer, and presented as an unsigned decimal number.
+ <literal>u</literal> - parametret bliver behandlet som et heltal og
+ præsenteret som et usigneret decimaltal.
</member>
<member>
- <literal>f</literal> - the argument is treated as a
- <type>float</type>, and presented as a floating-point number.
+ <literal>f</literal> - parametret bliver behandlet som et
+ <type>float</type>, og præsenteret som et flydende decimaltal.
</member>
<member>
- <literal>o</literal> - the argument is treated as an
- integer, and presented as an octal number.
+ <literal>o</literal> - parametret bliver behandlet som et heltal og
+ præsenteret som et oktaltal.
</member>
<member>
- <literal>s</literal> - the argument is treated as and
- presented as a string.
+ <literal>s</literal> - parametret bliver behandlet og præsenteret
+ som en streng.
</member>
<member>
- <literal>x</literal> - the argument is treated as an integer
- and presented as a hexadecimal number (with lowercase
- letters).
+ <literal>x</literal> - parametret bliver behandlet som et heltal og
+ præsenteret som et hexadecimaltal (med små bogstaver).
</member>
<member>
- <literal>X</literal> - the argument is treated as an integer
- and presented as a hexadecimal number (with uppercase
- letters).
+ <literal>X</literal> - parametret bliver behandlet som et heltal og
+ præsenteret som et hexadecimaltal (med store bogstaver).
</member>
</simplelist>
</para>
@@ -129,59 +118,58 @@
</orderedlist>
</para>
<para>
- As of PHP 4.0.6 the format string supports argument
- numbering/swapping. Here is an example:
+ Siden PHP 4.0.6 understøtter formateringsstrengen
+ parameternummering/ombytning. Her er et eksempel:
<example>
- <title>Argument swapping</title>
+ <title>Parameterombytning</title>
<programlisting role="php">
<![CDATA[
<?php
-$format = "There are %d monkeys in the %s";
+$format = "Der er %d aber i %s";
printf($format, $num, $location);
?>
]]>
</programlisting>
</example>
- This might output, "There are 5 monkeys in the tree". But
- imagine we are creating a format string in a separate file,
- commonly because we would like to internationalize it and we
- rewrite it as:
+ Dette kunne udskrive, "Der er 5 aber i træet". Men forestil dig at vi
+ skaber en formateringsstreng i en seperat fil, sædvanligvis fordi vi
+ ville internationalisere den og omskrive den således:
<example>
- <title>Argument swapping</title>
+ <title>Parameterombytning</title>
<programlisting role="php">
<![CDATA[
<?php
-$format = "The %s contains %d monkeys";
+$format = "%s indeholder %d aber";
printf($format, $num, $location);
?>
]]>
</programlisting>
</example>
- We now have a problem. The order of the placeholders in the
- format string does not match the order of the arguments in the
- code. We would like to leave the code as is and simply indicate
- in the format string which arguments the placeholders refer to.
- We would write the format string like this instead:
+ Vi har nu et problem. Rækkefølgen af pladsholderne i formateringsstrengen
+ matcher ikke rækkefølgen på parametrene i koden. Vi kunne godt tænke os
+ at efterlade koden som den er og simpelthen indikere i
+ formateringsstrengen hvilke parametre pladsholderne skal referere til. Vi
+ ville skrive formateringsstrengen sådan her i stedet:
<example>
- <title>Argument swapping</title>
+ <title>Parameterombytning</title>
<programlisting role="php">
<![CDATA[
<?php
-$format = "The %2\$s contains %1\$d monkeys";
+$format = "%2\$s indeholder %1\$d aber";
printf($format, $num, $location);
?>
]]>
</programlisting>
</example>
- An added benefit here is that you can repeat the placeholders without
- adding more arguments in the code. For example:
+ En tilføjet fordel her er at du kan gentage pladsholderne uden af tilføje
+ flere argumenter i koden. For eksempel:
<example>
- <title>Argument swapping</title>
+ <title>Parameterombytning</title>
<programlisting role="php">
<![CDATA[
<?php
-$format = "The %2\$s contains %1\$d monkeys.
- That's a nice %2\$s full of %1\$d monkeys.";
+$format = "%2\$s indeholder %1\$d aber.
+ Det er et rart %2\$s fuldt af %1\$d aber.";
printf($format, $num, $location);
?>
]]>
@@ -189,17 +177,19 @@
</example>
</para>
<simpara>
- See also <function>printf</function>,
- <function>sscanf</function>, <function>fscanf</function>,
- <function>vsprintf</function>, and
+ Se også
+ <function>printf</function>,
+ <function>sscanf</function>,
+ <function>fscanf</function>,
+ <function>vsprintf</function>, og
<function>number_format</function>.
</simpara>
</refsect1>
<refsect1>
- <title>Examples</title>
+ <title>Eksempler</title>
<para>
<example>
- <title><function>sprintf</function>: zero-padded integers</title>
+ <title><function>sprintf</function>: nul-udstoppede heltal</title>
<programlisting role="php">
<![CDATA[
<?php
@@ -209,28 +199,28 @@
</programlisting>
</example>
<example>
- <title><function>sprintf</function>: formatting currency</title>
+ <title><function>sprintf</function>: formaterer valuta</title>
<programlisting role="php">
<![CDATA[
<?php
$money1 = 68.75;
$money2 = 54.35;
$money = $money1 + $money2;
-// echo $money will output "123.1";
+// echo $money vil udskrive "123.1";
$formatted = sprintf("%01.2f", $money);
-// echo $formatted will output "123.10"
+// echo $formatted vil udskrive "123.10"
?>
]]>
</programlisting>
</example>
<example>
- <title><function>sprintf</function>: scientific notation</title>
+ <title><function>sprintf</function>: videnskabeligt tegnsystem</title>
<programlisting role="php">
<![CDATA[
<?php
$number = 362525200;
-echo sprintf("%.3e", $number); // outputs 3.63e+8
+echo sprintf("%.3e", $number); // udskriver 3.63e+8
?>
]]>
</programlisting>