Revert f56158b2 "[doc] string pages improved" for specific files where
[scilab.git] / scilab / modules / string / help / en_US / strcmp.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:ns4="http://www.w3.org/1999/xhtml"
18           xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org"
19           xml:id="strcmp" xml:lang="en">
20     <refnamediv>
21         <refname>strcmp</refname>
22         <refpurpose>compare character strings</refpurpose>
23     </refnamediv>
24     <refsynopsisdiv>
25         <title>Syntax</title>
26         <synopsis>
27             res = strcmp(string_one, string_two)
28             res = strcmp(string_one, string_two, "i")
29         </synopsis>
30     </refsynopsisdiv>
31     <refsection>
32         <title>Arguments</title>
33         <variablelist>
34             <varlistentry>
35                 <term>string_one</term>
36                 <listitem>
37                     <para>
38                         a character string or matrix of character strings.
39                     </para>
40                 </listitem>
41             </varlistentry>
42             <varlistentry>
43                 <term>string_two</term>
44                 <listitem>
45                     <para>
46                         a character string or matrix of character strings.
47                     </para>
48                 </listitem>
49             </varlistentry>
50             <varlistentry>
51                 <term>'i'</term>
52                 <listitem>
53                     <para>
54                         optional parameter to compare strings in a case-independent way.
55                         Default value is <literal>'s'</literal>.
56                     </para>
57                 </listitem>
58             </varlistentry>
59             <varlistentry>
60                 <term>res</term>
61                 <listitem>
62                     <para>a matrix of integers.</para>
63                 </listitem>
64             </varlistentry>
65         </variablelist>
66     </refsection>
67     <refsection>
68         <title>Description</title>
69         <para>
70             <code>res = strcmp(string_one, string_two)</code> (or
71             <code>res = strcmp(string_one, string_two, 's')</code>) returns an
72             integral value indicating the relationship between the strings.
73         </para>
74         <para>
75             The value greater than zero indicates that the first character that
76             does not match has a greater value in <varname>string_one</varname>
77             than in <varname>string_two</varname> and the value less than zero
78             indicates the opposite (lexicographical order).
79         </para>
80         <para>
81             The value equal zero indicates that <varname>string_one</varname>
82             and <varname>string_two</varname> are equal.
83         </para>
84         <para>
85             <code>res = strcmp(string_one, string_two, 'i')</code> returns
86             <literal>0</literal> if <varname>string_one</varname> is equal to
87             <varname>string_two</varname> (case independently) and
88             <literal>1</literal> indicates the opposite.
89         </para>
90     </refsection>
91     <refsection>
92         <title>Examples</title>
93         <programlisting role="example"><![CDATA[
94 TXT1 = ['scilab','SciLab';'Strcmp','STRcmp'];
95 TXT2 = ['ScIlAb','sciLab';'sTrCmP','StrCMP'];
96 strcmp(TXT1,TXT2)
97 strcmp(TXT1,'scilab')
98 strcmp(TXT1,'SciLab')
99 strcmp(TXT1,TXT2,'i')
100 strcmp(TXT1,TXT2,'s')
101     ]]></programlisting>
102     </refsection>
103     <refsection role="see also">
104         <title>See also</title>
105         <simplelist type="inline">
106             <member>
107                 <link linkend="convstr">convstr</link>
108             </member>
109             <member>
110                 <link linkend="comparison">comparison</link>
111             </member>
112         </simplelist>
113     </refsection>
114 </refentry>