cvs: phpdoc-da /reference/strings/functions sscanf.xml

[email protected] ("Jonathan Holst")
Newsgroups php.doc.da
Message-ID <cvsholst1090355552@cvsserver>
holst		Tue Jul 20 16:32:32 2004 EDT

  Added files:                 
    /phpdoc-da/reference/strings/functions	sscanf.xml 
  Log:
  
  Initial release
  
  

http://cvs.php.net/co.php/phpdoc-da/reference/strings/functions/sscanf.xml?r=1.1&p=1
Index: phpdoc-da/reference/strings/functions/sscanf.xml
+++ phpdoc-da/reference/strings/functions/sscanf.xml
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.1 $ -->
<!-- EN-Revision: 1.9 Maintainer: holst Status: ready -->
  <refentry id="function.sscanf">
   <refnamediv>
    <refname>sscanf</refname>
    <refpurpose>
     Analyserer input fra en streng ud fra en struktur
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Beskrivelse</title>
     <methodsynopsis>
      <type>mixed</type><methodname>sscanf</methodname>
      <methodparam><type>string</type><parameter>str</parameter></methodparam>
      <methodparam><type>string</type><parameter>format</parameter></methodparam>
      <methodparam choice="opt"><type>string</type><parameter>var1</parameter></methodparam>
     </methodsynopsis>
    <para>
     Funktionen <function>sscanf</function> er inputanalogen til
     <function>printf</function>. <function>sscanf</function> læser fra
     strengen <parameter>str</parameter> og fortolker den ud fra den
     specificerede <parameter>format</parameter>. Hvis kun to parametre bliver
     givet til denne funktion, vil værdierne der bliver analyseret returneret
     som et array.
    </para>
    <para>
     Ethvert mellemrum i strukturstrengen matcher alle mellemrum i
     inputstrengen. Dette betyder at selv et tab \t i strukturstrengen kan
     matche et enkelt mellemrumstegn i inputstrengen.
    </para>
    <para>
     <example>
      <title><function>sscanf</function> Eksempel</title>
      <programlisting role="php">
<![CDATA[
<?php
// hent serienummeret
$serial = sscanf("SN/2350001", "SN/%d");
// og fabriksdatoen
$mandate = "Januar 01 2000";
list($month, $day, $year) = sscanf($mandate, "%s %d %d");
echo "Element $serial blev fremstillet: $year-" . substr($month, 0, 3) . "-$day\n";
?>
]]>
      </programlisting>
     </example>
     Hvis valgfrie parametre bliver givet, vil funktionen returnere nummeret
     af fastsatte værdier.
     <example>
      <title><function>sscanf</function> - brug af valgfrie parametre</title>
      <programlisting role="php">
<![CDATA[
<?php
// hent forfatterinfo og generer DocBook-indlægget
$auth = "24\tKlaus Rifberg";
$n = sscanf($auth, "%d\t%s %s", $id, $first, $last);
echo "<author id='$id'>
    <firstname>$first</firstname>
    <surname>$last</surname>
</author>\n";
?>
]]>
      </programlisting>
     </example>
    </para>
    <para>
     Se også
     <function>fscanf</function>, 
     <function>printf</function> og
     <function>sprintf</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
-->
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.