Revert f56158b2 "[doc] string pages improved" for specific files where
[scilab.git] / scilab / modules / string / help / en_US / tokenpos.xml
1 <?xml version="1.0" encoding="UTF-8"?>
2 <!--
3  * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
4  * Copyright (C) INRIA -
5  *
6  * Copyright (C) 2012 - 2016 - Scilab Enterprises
7  *
8  * This file is hereby licensed under the terms of the GNU GPL v2.0,
9  * pursuant to article 5.3.4 of the CeCILL v.2.1.
10  * This file was originally licensed under the terms of the CeCILL v2.1,
11  * and continues to be available under such terms.
12  * For more information, see the COPYING file which you should have received
13  * along with this program.
14  *
15  -->
16 <refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"
17           xmlns:svg="http://www.w3.org/2000/svg" xmlns:db="http://docbook.org/ns/docbook"
18           xmlns:scilab="http://www.scilab.org" xml:lang="en" xml:id="tokenpos">
19     <refnamediv>
20         <refname>tokenpos</refname>
21         <refpurpose>
22             returns the tokens positions in a character string
23         </refpurpose>
24     </refnamediv>
25     <refsynopsisdiv>
26         <title>Syntax</title>
27         <synopsis>
28             kdf = tokenpos(str)
29             kdf = tokenpos(str, delimiter)
30         </synopsis>
31     </refsynopsisdiv>
32     <refsection>
33         <title>Arguments</title>
34         <variablelist>
35             <varlistentry>
36                 <term>str</term>
37                 <listitem>
38                     <para>
39                         a character string. The string where to search the tokens.
40                     </para>
41                 </listitem>
42             </varlistentry>
43             <varlistentry>
44                 <term>delimiter</term>
45                 <listitem>
46                     <para>
47                         (optional) a character or a vector of characters. The tokens delimiters.
48                     </para>
49                 </listitem>
50             </varlistentry>
51             <varlistentry>
52                 <term>kdf</term>
53                 <listitem>
54                     <para>
55                         a two column matrix, first column gives the index of the
56                         beginning of the tokens, the second gives the index of
57                         the last character of the tokens.
58                     </para>
59                 </listitem>
60             </varlistentry>
61         </variablelist>
62     </refsection>
63     <refsection>
64         <title>Description</title>
65         <para>
66             <code>kdf = tokenpos(str [,delimiter])</code> searches the tokens
67             included in the string <varname>str</varname>. The
68             <varname>delimiter</varname> default value is <literal>[" ",&lt;Tab&gt;]</literal>
69             where <literal>&lt;Tab&gt;</literal> stands for
70             <code>ascii(9)</code>. It returns the indices of the first and last
71             characters of each found tokens.
72         </para>
73     </refsection>
74     <refsection>
75         <title>Examples</title>
76         <programlisting role="example"><![CDATA[
77 str = 'This is a character string';
78 kdf = tokenpos(str)
79 first = part(str, kdf(1,1):kdf(1,2))
80  ]]></programlisting>
81     </refsection>
82     <refsection role="see also">
83         <title>See also</title>
84         <simplelist type="inline">
85             <member>
86                 <link linkend="strindex">strindex</link>
87             </member>
88             <member>
89                 <link linkend="tokens">tokens</link>
90             </member>
91         </simplelist>
92     </refsection>
93 </refentry>