Revert f56158b2 "[doc] string pages improved" for specific files where
[scilab.git] / scilab / modules / string / help / en_US / strsubst.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:ns5="http://www.w3.org/1999/xhtml"
18           xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org"
19           xml:id="strsubst" xml:lang="en">
20     <refnamediv>
21         <refname>strsubst</refname>
22         <refpurpose>
23             substitute a character string by another in a character string
24         </refpurpose>
25     </refnamediv>
26     <refsynopsisdiv>
27         <title>Syntax</title>
28         <synopsis>
29             string_out = strsubst(string_in, searchStr, replaceStr)
30             string_out = strsubst(string_in, searchStr, replaceStr, "regexp")
31         </synopsis>
32     </refsynopsisdiv>
33     <refsection>
34         <title>Arguments</title>
35         <variablelist>
36             <varlistentry>
37                 <term>string_in</term>
38                 <listitem>
39                     <para>
40                         a matrix of character strings. The strings where to
41                         search occurrences of <varname>searchStr</varname>.
42                     </para>
43                 </listitem>
44             </varlistentry>
45             <varlistentry>
46                 <term>searchStr</term>
47                 <listitem>
48                     <para>
49                         a character string. The string to search in
50                         <varname>string_in</varname>.
51                     </para>
52                 </listitem>
53             </varlistentry>
54             <varlistentry>
55                 <term>replaceStr</term>
56                 <listitem>
57                     <para>
58                         a character string. The replacement string.
59                     </para>
60                 </listitem>
61             </varlistentry>
62             <varlistentry>
63                 <term>string_out</term>
64                 <listitem>
65                     <para>
66                         a matrix of character strings. The result of the
67                         substitution on <varname>searchStr</varname> by
68                         <varname>replaceStr</varname> in <varname>string_in</varname>.
69                     </para>
70                 </listitem>
71             </varlistentry>
72             <varlistentry>
73                 <term>"regexp" | "r" flag</term>
74                 <listitem>
75                     <para>
76                         Then <varname>searchStr</varname> is used as a regular expression.
77                     </para>
78                 </listitem>
79             </varlistentry>
80         </variablelist>
81     </refsection>
82     <refsection>
83         <title>Description</title>
84         <para>
85             The <function>strsubst</function> function replaces all occurrences of
86             <varname>searchStr</varname> in <varname>string_in</varname> by
87             <varname>replaceStr</varname>.
88         </para>
89         <para>
90             When using the forth parameter <literal>"r"</literal>, the <varname>searchStr</varname> should be a
91             string of regular expression. And then <function>strsubst</function> is going to match it with
92             <varname>string_in</varname> and replace according to the regular expression rules.
93         </para>
94     </refsection>
95     <refsection>
96         <title>Examples</title>
97         <programlisting role="example"><![CDATA[
98 strsubst('SCI/demos/scicos','SCI','.')
99 strsubst('SCI/demos/scicos','/',' ')
100 strsubst('2' ,'/2(]*)?$\1/' ,'0','r')
101  ]]></programlisting>
102     </refsection>
103     <refsection role="see also">
104         <title>See also</title>
105         <simplelist type="inline">
106             <member>
107                 <link linkend="string">string</link>
108             </member>
109             <member>
110                 <link linkend="strings">strings</link>
111             </member>
112         </simplelist>
113     </refsection>
114 </refentry>