Also update the URL to the CeCILL license. Thanks to Paul for noticing that
[scilab.git] / scilab / modules / string / help / en_US / part.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  * This file must be used under the terms of the CeCILL.
7  * This source file is licensed as described in the file COPYING, which
8  * you should have received as part of this distribution.  The terms
9  * are also available at    
10  * http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
11  *
12  -->
13 <refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xml:id="part" xml:lang="en">
14     <refnamediv>
15         <refname>part</refname>
16         <refpurpose>extraction of strings</refpurpose>
17     </refnamediv>
18     <refsynopsisdiv>
19         <title>Calling Sequence</title>
20         <synopsis>[strings_out] = part(strings_in, v)</synopsis>
21     </refsynopsisdiv>
22     <refsection>
23         <title>Arguments</title>
24         <variablelist>
25             <varlistentry>
26                 <term>strings_in, strings_out</term>
27                 <listitem>
28                     <para>matrices of character strings.</para>
29                 </listitem>
30             </varlistentry>
31             <varlistentry>
32                 <term>v</term>
33                 <listitem>
34                     <para>an integer row vector.</para>
35                 </listitem>
36             </varlistentry>
37         </variablelist>
38     </refsection>
39     <refsection>
40         <title>Description</title>
41         <para>
42             Let <literal>s[k]</literal> stands for the <literal>k</literal>
43             character of string <literal>s</literal> (or the white space
44             character if <literal>k &gt;length(s)</literal>).
45         </para>
46         <para>
47             <function>part</function> returns <varname>strings_out</varname>, a
48             matrix of character strings, such that
49             <literal>strings_out(i,j)</literal> is the string
50             <literal>"s[v(1)]...s[v(n)]"</literal>
51             (<literal>s=strings_in(i,j)</literal>).
52         </para>
53     </refsection>
54     <refsection>
55         <title>Examples</title>
56         <programlisting role="example"><![CDATA[
57 // returns characters position 8 to 11
58 part("How to use ""part"" ?",8:11)
59
60 // returns characters position 2 to 4 for each element
61 // no characters replaced by ''
62 c = part(['a','abc','abcd'],2:4)
63
64 // returns character position 1 for each element and add characters position
65 // 4 to 7 of each element
66 c = part(['abcdefg','hijklmn','opqrstu'],[1,4:7]);
67
68 // returns character 4 for each element, add characters position 1 to 7 and
69 // add character position 4 for each element
70 c = part(['abcdefg','hijklmn','opqrstu'],[4,1:7,4]);
71
72 // returns character position 1, add again character position 1 and
73 // character position 2
74 c=part(['a','abc','abcd'],[1,1,2])
75
76 // a a a
77 part(['a','abc','abcd'],[1])
78
79 // aa aa aa
80 part(['a','abc','abcd'],[1,1])
81
82 // aa aab aab
83 part(['a','abc','abcd'],[1,1,2])
84     ]]></programlisting>
85     </refsection>
86     <refsection role="see also">
87         <title>See Also</title>
88         <simplelist type="inline">
89             <member>
90                 <link linkend="string">string</link>
91             </member>
92             <member>
93                 <link linkend="strsplit">strsplit</link>
94             </member>
95             <member>
96                 <link linkend="length">length</link>
97             </member>
98         </simplelist>
99     </refsection>
100 </refentry>