* along with this program.
*
-->
-<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:lang="en" xml:id="convstr">
+<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns:svg="http://www.w3.org/2000/svg" xmlns:db="http://docbook.org/ns/docbook"
+ xmlns:scilab="http://www.scilab.org" xml:lang="en" xml:id="convstr">
<refnamediv>
<refname>convstr</refname>
<refpurpose>case conversion</refpurpose>
</refnamediv>
<refsynopsisdiv>
<title>Syntax</title>
- <synopsis>[y] = convstr(str, [flag])</synopsis>
+ <synopsis>
+ y = convstr(str)
+ y = convstr(str, flag)
+ </synopsis>
</refsynopsisdiv>
<refsection>
<title>Arguments</title>
* along with this program.
*
-->
-<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" xmlns:scilab="http://www.scilab.org" xml:id="grep" xml:lang="en">
+<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:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org"
+ xml:id="grep" xml:lang="en">
<refnamediv>
<refname>grep</refname>
<refpurpose>find matches of a string in a vector of strings</refpurpose>
</refnamediv>
<refsynopsisdiv>
<title>Syntax</title>
- <synopsis>row = grep(haystack, needle )
+ <synopsis>
[row, which] = grep(haystack, needle )
- row = grep(haystack, needle, [flag])
- [row, which] = grep(haystack, needle, [flag])
+ [row, which] = grep(haystack, needle, "regexp" )
</synopsis>
</refsynopsisdiv>
<refsection>
</listitem>
</varlistentry>
<varlistentry>
- <term>flag</term>
+ <term>"regexp" | "r" flag</term>
<listitem>
<para>
- a character (<literal>"r"</literal> for regular expression).
+ single character: Then <varname>needle</varname> elements are used as
+ <emphasis role="bold">r</emphasis>egular expressions.
</para>
</listitem>
</varlistentry>
</para>
</refsection>
<refsection>
- <title>Example #1</title>
+ <title>Examples</title>
+ <para><emphasis role="bold">Example #1</emphasis></para>
<para>
In the following example, we search one or two strings in a text,
which is stored in the <varname>txt</varname> variable.
[r,w]=grep(txt,['strings' 'Strings'])
]]></programlisting>
- </refsection>
- <refsection>
- <title>Example #2</title>
+ <para/>
+
+ <para><emphasis role="bold">Example #2</emphasis></para>
<para>In the following example, we perform regexp searches.</para>
<programlisting role="example"><![CDATA[
str = ["hat";"cat";"hhat";"chat";"hcat";"ccchat";"at";"dog"]
<member>
<link linkend="regexp">regexp</link>
</member>
+ <member>
+ <link linkend="find">find</link>
+ </member>
+ <member>
+ <link linkend="vectorfind">vectorfind</link>
+ </member>
</simplelist>
</refsection>
</refentry>
<!--
* Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
* Copyright (C) INRIA -
- *
* Copyright (C) 2012 - 2016 - Scilab Enterprises
+ * Copyright (C) 2020 - Samuel GOUGEON
*
* This file is hereby licensed under the terms of the GNU GPL v2.0,
* pursuant to article 5.3.4 of the CeCILL v.2.1.
* along with this program.
*
-->
-<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:lang="en" xml:id="isascii">
+<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns:svg="http://www.w3.org/2000/svg" xmlns:db="http://docbook.org/ns/docbook"
+ xmlns:scilab="http://www.scilab.org" xml:lang="en" xml:id="isascii">
<refnamediv>
<refname>isascii</refname>
- <refpurpose>tests if character is a 7-bit US-ASCII character</refpurpose>
+ <refpurpose>
+ Tests if every character of given strings is 7-bit US-ASCII
+ </refpurpose>
</refnamediv>
<refsynopsisdiv>
<title>Syntax</title>
<refsection>
<title>Examples</title>
<programlisting role="example"><![CDATA[
-letters = [115. 99. 105. 108. 97. 98.]
-isascii(letters)
-ascii(letters)
-isascii('scilab')
- ]]></programlisting>
+isascii("Señor")
+
+nt = ascii("Señor")
+isascii(nt)
+
+t = "We know that γ² = 1/(1-β²)";
+isascii(t)
+part(t, find(~isascii(t)))
+ ]]></programlisting>
+ <screen><![CDATA[
+--> isascii("Señor")
+ ans =
+ T T F T T
+
+--> nt = ascii("Señor")
+ nt =
+ 83. 101. 195. 177. 111. 114.
+
+--> isascii(nt)
+ ans =
+ T T F F T T
+
+
+--> t = "We know that γ² = 1/(1-β²)";
+--> isascii(t)
+ ans =
+ T T T T T T T T T T T T T F F T T T T T T T T F F T
+
+--> part(t, find(~isascii(t)))
+ ans =
+ "γ²β²"
+]]></screen>
</refsection>
<refsection role="see also">
<title>See also</title>
<simplelist type="inline">
<member>
+ <link linkend="ascii">ascii</link>
+ </member>
+ <member>
<link linkend="isalphanum">isalphanum</link>
</member>
+ <member>
+ <link linkend="isdigit">isdigit</link>
+ </member>
+ <member>
+ <link linkend="isletter">isletter</link>
+ </member>
+ <member>
+ <link linkend="isnum">isnum</link>
+ </member>
</simplelist>
</refsection>
</refentry>
* along with this program.
*
-->
-<refentry xmlns="http://docbook.org/ns/docbook"
- xmlns:xlink="http://www.w3.org/1999/xlink"
- xmlns:svg="http://www.w3.org/2000/svg"
- xmlns:mml="http://www.w3.org/1998/Math/MathML"
- xmlns:db="http://docbook.org/ns/docbook"
- xml:lang="en" xml:id="justify">
+<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns:svg="http://www.w3.org/2000/svg" xmlns:mml="http://www.w3.org/1998/Math/MathML"
+ xmlns:db="http://docbook.org/ns/docbook" xml:lang="en" xml:id="justify">
<refnamediv>
<refname>justify</refname>
- <refpurpose>justify character array</refpurpose>
+ <refpurpose>aligns texts in columns to the left, center, or right</refpurpose>
</refnamediv>
<refsynopsisdiv>
<title>Syntax</title>
- <synopsis>Tj = justify(T, opt)</synopsis>
+ <synopsis>Tj = justify(T, position)</synopsis>
</refsynopsisdiv>
<refsection>
<title>Arguments</title>
</listitem>
</varlistentry>
<varlistentry>
- <term>opt</term>
+ <term>position</term>
<listitem>
<para>
- a character option with possible values:
+ Possible values:
+ <table cellspacing="0" cellpadding="0">
+ <tr><td><term>'l' or 'left'</term></td><td>: left justification</td></tr>
+ <tr><td><term>'c' or 'center'</term></td><td>: centering</td></tr>
+ <tr><td><term>'r' or 'right'</term></td><td>: right justification</td></tr>
+ </table>
</para>
- <variablelist>
- <varlistentry>
- <term>'r' or 'right'</term>
- <listitem>
- <para>for right justification;</para>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term>'l' or 'left'</term>
- <listitem>
- <para>for left justification;</para>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term>'c' or 'center'</term>
- <listitem>
- <para>for centering justification.</para>
- </listitem>
- </varlistentry>
- </variablelist>
</listitem>
</varlistentry>
</variablelist>
<title>Description</title>
<para>
The <function>justify</function> function justifies the column of a
- matrix of string according to the given option <varname>opt</varname>.
+ matrix of string according to the given <varname>position</varname>.
</para>
</refsection>
<refsection>
* along with this program.
*
-->
-<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="length" xml:lang="en">
+<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="length" xml:lang="en">
<refnamediv>
<refname>length</refname>
- <refpurpose>length of object</refpurpose>
+ <refpurpose>Number of characters of a text. Number of elements of an array or list.</refpurpose>
</refnamediv>
<refsynopsisdiv>
<title>Syntax</title>
* along with this program.
*
-->
-<refentry xmlns="http://docbook.org/ns/docbook"
-xmlns:xlink="http://www.w3.org/1999/xlink"
-xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns4="http://www.w3.org/1999/xhtml"
-xmlns:mml="http://www.w3.org/1998/Math/MathML"
-xmlns:db="http://docbook.org/ns/docbook"
-xml:id="regexp" xml:lang="en">
+<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns4="http://www.w3.org/1999/xhtml"
+ xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook"
+ xml:id="regexp" xml:lang="en">
<refnamediv>
<refname>regexp</refname>
<refpurpose>
<refsynopsisdiv>
<title>Syntax</title>
<synopsis>
- [start] = regexp(input, pattern, [flag])
- [start, final] = regexp(input, pattern, [flag])
- [start, final, match] = regexp(input, pattern, [flag])
- [start, final, match, foundString] = regexp(input, pattern, [flag])
+ [start, final, match, foundString] = regexp(input, pattern)
+ [start, final, match, foundString] = regexp(input, pattern, "once")
</synopsis>
</refsynopsisdiv>
<refsection>
</listitem>
</varlistentry>
<varlistentry>
- <term>[flag]</term>
+ <term>"once | "o" flag</term>
<listitem>
<para>
- <literal>'o'</literal> for matching the pattern once.
+ <literal>'o'</literal> for matching the pattern only once.
</para>
</listitem>
</varlistentry>
* along with this program.
*
-->
-<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="strcat" xml:lang="en">
+<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:db="http://docbook.org/ns/docbook" xml:id="strcat" xml:lang="en">
<refnamediv>
<refname>strcat</refname>
<refpurpose>concatenates character strings</refpurpose>
<refsynopsisdiv>
<title>Syntax</title>
<synopsis>
- txt = strcat(strings [,string_added])
- txt = strcat(strings [,string_added, ["flag"]])
+ txt = strcat(strings)
+ txt = strcat(strings, string_added)
+ txt = strcat(strings, string_added, "r")
+ txt = strcat(strings, string_added, "c")
</synopsis>
</refsynopsisdiv>
<refsection>
<varlistentry>
<term>strings</term>
<listitem>
- <para>a vector or matrix of strings.</para>
+ <para>vector, matrix, or hypermatrix of strings.</para>
</listitem>
</varlistentry>
<varlistentry>
</listitem>
</varlistentry>
<varlistentry>
- <term>"flag"</term>
+ <term>"r" | "c" flag</term>
<listitem>
<para>
- a character (<literal>"r"</literal> for concatenation of
- rows in the matrix <varname>strings</varname>,
- <literal>"c"</literal> for concatenations of columns in the
- matrix <varname>strings</varname>).
+ <literal>"r"</literal> glues together all <emphasis role="bold">r</emphasis>ows
+ of each column, in the array <varname>strings</varname>.
+ If <varname>strings</varname> is a matrix, <varname>txt</varname> is a
+ <emphasis role="bold">r</emphasis>ow of longer strings.
+ <literal>"c"</literal> glues all columns of each row.
</para>
</listitem>
</varlistentry>
<member>
<link linkend="strings">strings</link>
</member>
+ <member>
+ <link linkend="strsplit">strsplit</link>
+ </member>
+ <member>
+ <link linkend="brackets">brackets []</link>
+ </member>
</simplelist>
</refsection>
</refentry>
* along with this program.
*
-->
-<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns4="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="strcmp" xml:lang="en">
+<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns4="http://www.w3.org/1999/xhtml"
+ xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org"
+ xml:id="strcmp" xml:lang="en">
<refnamediv>
<refname>strcmp</refname>
<refpurpose>compare character strings</refpurpose>
</refnamediv>
<refsynopsisdiv>
<title>Syntax</title>
- <synopsis>res = strcmp(string_one, string_two, ['i'])</synopsis>
+ <synopsis>
+ res = strcmp(string_one, string_two)
+ res = strcmp(string_one, string_two, "i")
+ </synopsis>
</refsynopsisdiv>
<refsection>
<title>Arguments</title>
* along with this program.
*
-->
-<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns4="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="strcspn" xml:lang="en">
+<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns4="http://www.w3.org/1999/xhtml"
+ xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org"
+ xml:id="strcspn" xml:lang="en">
<refnamediv>
<refname>strcspn</refname>
- <refpurpose>get span until character in string</refpurpose>
+ <refpurpose>
+ lengths from the beginning of texts until a character among those prohibited
+ </refpurpose>
</refnamediv>
<refsynopsisdiv>
<title>Syntax</title>
* along with this program.
*
-->
-<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns4="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="strindex" xml:lang="en">
+<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns4="http://www.w3.org/1999/xhtml"
+ xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org"
+ xml:id="strindex" xml:lang="en">
<refnamediv>
<refname>strindex</refname>
<refpurpose>
<refsynopsisdiv>
<title>Syntax</title>
<synopsis>
- ind = strindex(haystack, needle, [flag])
- [ind, which] = strindex(haystack, needle, [flag])
+ [ind, which] = strindex(haystack, needle)
+ [ind, which] = strindex(haystack, needle, "regexp")
</synopsis>
</refsynopsisdiv>
<refsection>
</listitem>
</varlistentry>
<varlistentry>
- <term>flag</term>
+ <term>"regexp" | "r" flag</term>
<listitem>
<para>
- a string (<literal>"r"</literal> for regular expression).
+ Then <varname>needle</varname> elements are used as regular expressions.
</para>
</listitem>
</varlistentry>
* along with this program.
*
-->
-<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:lang="en" xml:id="strncpy">
+<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns:svg="http://www.w3.org/2000/svg" xmlns:db="http://docbook.org/ns/docbook"
+ xmlns:scilab="http://www.scilab.org" xml:lang="en" xml:id="strncpy">
<refnamediv>
<refname>strncpy</refname>
- <refpurpose>copy characters from strings</refpurpose>
+ <refpurpose>gets and gives the N first characters of the given texts</refpurpose>
</refnamediv>
<refsynopsisdiv>
<title>Syntax</title>
* along with this program.
*
-->
-<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:lang="en" xml:id="strrev">
+<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns:svg="http://www.w3.org/2000/svg" xmlns:db="http://docbook.org/ns/docbook"
+ xmlns:scilab="http://www.scilab.org" xml:lang="en" xml:id="strrev">
<refnamediv>
<refname>strrev</refname>
- <refpurpose>returns string reversed</refpurpose>
+ <refpurpose>
+ Reverses the order of characters in the given texts
+ </refpurpose>
</refnamediv>
<refsynopsisdiv>
<title>Syntax</title>
<!--
* Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
* Copyright (C) INRIA -
- *
* Copyright (C) 2012 - 2016 - Scilab Enterprises
+ * Copyright (C) 2020 - Samuel GOUGEON
*
* This file is hereby licensed under the terms of the GNU GPL v2.0,
* pursuant to article 5.3.4 of the CeCILL v.2.1.
* along with this program.
*
-->
-<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns4="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="strspn" xml:lang="en">
+<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns4="http://www.w3.org/1999/xhtml"
+ xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org"
+ xml:id="strspn" xml:lang="en">
<refnamediv>
<refname>strspn</refname>
- <refpurpose>get span of character set in string</refpurpose>
+ <refpurpose>
+ lengths of the beginning of texts as long as characters are among those allowed
+ </refpurpose>
</refnamediv>
<refsynopsisdiv>
<title>Syntax</title>
- <synopsis>res = strspn(str1, str2)</synopsis>
+ <synopsis>headsLengths = strspn(Texts, allowedChars)</synopsis>
</refsynopsisdiv>
<refsection>
<title>Arguments</title>
<variablelist>
<varlistentry>
- <term>str1</term>
- <listitem>
- <para>
- a character string or matrix of character strings.
- </para>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term>str2</term>
+ <term>Texts, allowedChars, headsLengths</term>
<listitem>
<para>
- a character string or matrix of character strings.
+ Matrices of texts, of identical dimensions.
+ <varname>allowedChars</varname> can be a scalar string.
+ It is then used for all <varname>Texts</varname> components.
</para>
</listitem>
</varlistentry>
- <varlistentry>
- <term>res</term>
- <listitem>
- <para>a matrix of character strings.</para>
- </listitem>
- </varlistentry>
</variablelist>
</refsection>
<refsection>
<title>Description</title>
<para>
- <code>res = strspn(str1, str2)</code> returns the length of the initial portion of <varname>str1</varname> which consists only of characters that are part of <varname>str2</varname>.
- </para>
- <para>
- <varname>str1</varname> must have same dimensions as <varname>str2</varname> or <varname>str2</varname> must be 1x1 string. The output will be the same dimensions as <varname>str1</varname> in both cases.
+ <literal>headsLengths = strspn(Texts, allowedChars)</literal> returns the length of the initial
+ portion of <varname>Texts</varname> which consists only of characters that are part of
+ <varname>allowedChars</varname>.
</para>
</refsection>
<refsection>
<title>Examples</title>
<programlisting role="example"><![CDATA[
-i = strspn("129th","1234567890");
-mprintf ("The length of initial number is %d.\n",i);
-i = strspn(["129th","130th"],["1234567890","130t"])
+allowed = "0":"9"
+strspn("129th or the 130th", allowed)
+
+t = ["characters" "matrix" ; "text" "strings"]
+allowed = "a":"s"
+strspn(t, allowed)
+
+allowed = ["a":"j", "a":"u" ; "d":"u", "g":"v"]
+strspn(t, allowed)
+ ]]></programlisting>
+ <screen><![CDATA[
+--> allowed = "0":"9"
+ allowed =
+ "0123456789"
+
+--> strspn("129th or the 130th", allowed)
+ ans =
+ 3.
+
+
+--> t = ["characters" "matrix" ; "text" "strings"]
+ t =
+ "characters" "matrix"
+ "text" "strings"
+
+--> allowed = "a":"s"
+ allowed =
+ "abcdefghijklmnopqrs"
+--> strspn(t, allowed)
+ ans =
+ 6. 2.
+ 0. 1.
+
+--> allowed = ["a":"j", "a":"u" ; "d":"u", "g":"v"]
+ allowed =
+ "abcdefghij" "abcdefghijklmnopqrstu"
+ "defghijklmnopqrstu" "ghijklmnopqrstuv"
+
+--> strspn(t, allowed)
+ ans =
+ 3. 5.
+ 2. 7.
+]]></screen>
+ <para>
+ With UTF-8 extended characters:
+ </para>
+ <programlisting role="example"><![CDATA[
+t = "Να αμφιβάλλετε τα πάντα ή να μην αμφιβάλλετε τίποτα: " + ..
+ "δύο ίσοι τρόποι αποφυγής σκέψης.";
+t = matrix(strsplit(t," "), 2,-1)
+allowed = "Ναβγδεϵζηθικλμνξοπρστυφϕχψωϐϑϰϱςϖ";
+strspn(t, allowed)
]]></programlisting>
+ <screen><![CDATA[
+--> t = matrix(strsplit(t," "), 2,-1)
+ t =
+ "Να" "τα" "ή" "μην" "τίποτα:" "ίσοι" "αποφυγής"
+ "αμφιβάλλετε" "πάντα" "να" "αμφιβάλλετε" "δύο" "τρόποι" "σκέψης."
+
+--> allowed = "Ναβγδεϵζηθικλμνξοπρστυφϕχψωϐϑϰϱςϖ";
+--> strspn(t, allowed)
+ ans =
+ 2. 2. 0. 3. 1. 0. 6.
+ 5. 1. 2. 5. 1. 2. 2.
+]]></screen>
</refsection>
<refsection role="see also">
<title>See also</title>
<member>
<link linkend="strcspn">strcspn</link>
</member>
+ <member>
+ <link linkend="strncpy">strncpy</link>
+ </member>
+ <member>
+ <link linkend="part">part</link>
+ </member>
</simplelist>
</refsection>
</refentry>
<!--
* Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
* Copyright (C) INRIA -
- *
* Copyright (C) 2012 - 2016 - Scilab Enterprises
+ * Copyright (C) 2020 - Samuel GOUGEON
*
* This file is hereby licensed under the terms of the GNU GPL v2.0,
* pursuant to article 5.3.4 of the CeCILL v.2.1.
* along with this program.
*
-->
-<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns4="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="strstr" xml:lang="en">
+<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns4="http://www.w3.org/1999/xhtml"
+ xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org"
+ xml:id="strstr" xml:lang="en">
<refnamediv>
<refname>strstr</refname>
- <refpurpose>locate substring</refpurpose>
+ <refpurpose>
+ Tail of a text starting from the 1st occurrrence of a given fragment
+ </refpurpose>
</refnamediv>
<refsynopsisdiv>
<title>Syntax</title>
- <synopsis>res = strstr(haystack, needle)</synopsis>
+ <synopsis>Tail = strstr(Text, StartingFragment)</synopsis>
</refsynopsisdiv>
<refsection>
<title>Arguments</title>
<variablelist>
<varlistentry>
- <term>haystack</term>
- <listitem>
- <para>
- a character string or matrix of character strings.
- </para>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term>needle</term>
+ <term>Text, StartingFragment, Tail</term>
<listitem>
<para>
- a character string or matrix of character strings.
- </para>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term>res</term>
- <listitem>
- <para>
- a character string or matrix of character strings.
+ Matrices of texts, of identical dimensions.
+ <varname>StartingFragments</varname> can be a single text. It is then used
+ for all <varname>Texts</varname> components.
</para>
</listitem>
</varlistentry>
<refsection>
<title>Description</title>
<para>
- <code>res = strstr(haystack, needle)</code> returns a string matrix
- starting from where the first occurrence of
- <varname>needle</varname> in <varname>haystack</varname> to the end
- of <varname>haystack</varname>, or <literal>''</literal> if there
- <varname>needle</varname> is not part of <varname>haystack</varname>.
+ <literal>Tail = strstr(Text, StartingFragment)</literal> builds and returns a matrix
+ of texts such that, for each element <literal>Text(i)</literal>, <literal>Tail(i)</literal>
+ is the part of <literal>Text(i)</literal> starting from the first occurrence of
+ <literal>startingFragment(i)</literal>, up to the end of <literal>Text(i)</literal>.
+ </para>
+ <para>
+ If <varname>StartingFragment(i)</varname> is not found in <literal>Text(i)</literal>,
+ <literal>Tail(i)</literal> is set to <literal>""</literal>.
</para>
</refsection>
<refsection>
* along with this program.
*
-->
-<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" xmlns:scilab="http://www.scilab.org" xml:id="strsubst" xml:lang="en">
+<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:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org"
+ xml:id="strsubst" xml:lang="en">
<refnamediv>
<refname>strsubst</refname>
<refpurpose>
<title>Syntax</title>
<synopsis>
string_out = strsubst(string_in, searchStr, replaceStr)
- string_out = strsubst(string_in, searchStr, replaceStr, [flag])
+ string_out = strsubst(string_in, searchStr, replaceStr, "regexp")
</synopsis>
</refsynopsisdiv>
<refsection>
</listitem>
</varlistentry>
<varlistentry>
- <term>flag</term>
+ <term>"regexp" | "r" flag</term>
<listitem>
<para>
- a character (<literal>"r"</literal> for regular expression).
+ Then <varname>searchStr</varname> is used as a regular expression.
</para>
</listitem>
</varlistentry>
<refsynopsisdiv>
<title>Syntax</title>
<synopsis>
- d = strtod(str [,decimalseparator])
- [d, tails] = strtod(str [,decimalseparator])
+ [d, tails] = strtod(str)
+ [d, tails] = strtod(str, decimalseparator)
</synopsis>
</refsynopsisdiv>
<refsection role="arguments">
* along with this program.
*
-->
-<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:lang="en" xml:id="tokenpos">
+<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns:svg="http://www.w3.org/2000/svg" xmlns:db="http://docbook.org/ns/docbook"
+ xmlns:scilab="http://www.scilab.org" xml:lang="en" xml:id="tokenpos">
<refnamediv>
<refname>tokenpos</refname>
<refpurpose>
</refnamediv>
<refsynopsisdiv>
<title>Syntax</title>
- <synopsis>kdf = tokenpos(str [,delimiter])</synopsis>
+ <synopsis>
+ kdf = tokenpos(str)
+ kdf = tokenpos(str, delimiter)
+ </synopsis>
</refsynopsisdiv>
<refsection>
<title>Arguments</title>
<!--
* Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
* Copyright (C) INRIA -
- *
* Copyright (C) 2012 - 2016 - Scilab Enterprises
+ * Copyright (C) 2020 - Samuel GOUGEON
*
* This file is hereby licensed under the terms of the GNU GPL v2.0,
* pursuant to article 5.3.4 of the CeCILL v.2.1.
* along with this program.
*
-->
-<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:lang="en" xml:id="tokens">
+<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns:svg="http://www.w3.org/2000/svg" xmlns:db="http://docbook.org/ns/docbook"
+ xmlns:scilab="http://www.scilab.org" xml:lang="en" xml:id="tokens">
<refnamediv>
<refname>tokens</refname>
- <refpurpose>returns the tokens of a character string</refpurpose>
+ <refpurpose>
+ Splits a text using separators and gives its chunks
+ </refpurpose>
</refnamediv>
<refsynopsisdiv>
<title>Syntax</title>
- <synopsis>T = tokens(str [,delimiter])</synopsis>
+ <synopsis>
+ Chunks = tokens(text)
+ Chunks = tokens(text, separators)
+ </synopsis>
</refsynopsisdiv>
<refsection>
<title>Arguments</title>
<variablelist>
<varlistentry>
- <term>str</term>
+ <term>text</term>
<listitem>
- <para>
- a character string. The string where to search the tokens.
- </para>
+ A single text to be split. It can include extended UTF-8 international characters.
+ <para/>
</listitem>
</varlistentry>
<varlistentry>
- <term>delimiter</term>
+ <term>separators</term>
<listitem>
- <para>
- (optional) a character or a vector of characters. The tokens delimiters.
- </para>
+ Vector of characters. Default value =
+ <literal>[" ", ascii(9)]</literal>, ascii(9) being the horizontal tab.
+ <para/>
</listitem>
</varlistentry>
<varlistentry>
- <term>T</term>
+ <term>Chunks</term>
<listitem>
- <para>
- a column vector of found tokens.
- </para>
+ Column vector: Pieces of the split text.
+ <para/>
</listitem>
</varlistentry>
</variablelist>
<refsection>
<title>Description</title>
<para>
- <code>T = tokens(str [,delimiter]) </code> searches the tokens
- included in the string <varname>str</varname>. The
- <varname>delimiter</varname> default value is <literal>[" ",<Tab>]</literal>
- where <literal><Tab></literal> stands for <code>ascii(9)</code>.
+ <literal>tokens(…)</literal> searches the text for given separator(s),
+ and splits it into chunks. Chunks are free of separators.
+ Consecutive separators are merged.
</para>
</refsection>
<refsection>
<title>Examples</title>
<programlisting role="example"><![CDATA[
-tokens('This is a character string')
+tokens("The given text")
+
+tokens("SCI/demos/scicos", "/")'
-tokens('SCI/demos/scicos','/')
+tokens("Επιστήμη και καινοτομία", ["α"," "])'
-tokens('y=a+b*2',['=','+','*'])
+nbsp = ascii(160); // non-breakable space
+t = "the" + nbsp + "given text"
+tokens(t)
]]></programlisting>
+ <screen><![CDATA[
+--> tokens('The given text')
+ ans =
+ "The"
+ "given"
+ "text"
+
+
+--> tokens('SCI/demos/scicos', '/')'
+ ans =
+ "SCI" "demos" "scicos"
+
+
+--> tokens("Επιστήμη και καινοτομία", ["α"," "])'
+ ans =
+ "Επιστήμη" "κ" "ι" "κ" "ινοτομί"
+
+
+--> nbsp = ascii(160); // non-breakable space
+--> t = "the" + nbsp + "given text"
+ t =
+ "the given text"
+
+--> tokens(t)
+ ans =
+ "the given"
+ "text"
+]]></screen>
</refsection>
<refsection role="see also">
<title>See also</title>
<simplelist type="inline">
<member>
+ <link linkend="strsplit">strsplit</link>
+ </member>
+ <member>
+ <link linkend="regexp">regexp</link>
+ </member>
+ <member>
<link linkend="strindex">strindex</link>
</member>
<member>
<refsynopsisdiv>
<title>Syntaxe</title>
<synopsis>
- d = strtod(str [,decimalseparator])
- [d, tails] = strtod(str [,decimalseparator])
+ [d, tails] = strtod(str)
+ [d, tails] = strtod(str, decimalseparator)
</synopsis>
</refsynopsisdiv>
<refsection role="arguments">
*
-->
-<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:lang="ja" xml:id="convstr">
+<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns:svg="http://www.w3.org/2000/svg" xmlns:db="http://docbook.org/ns/docbook"
+ xmlns:scilab="http://www.scilab.org" xml:lang="ja" xml:id="convstr">
<refnamediv>
<title>呼び出し手順</title>
- <synopsis>[y] = convstr(str, [flag])</synopsis>
+ <synopsis>
+ y = convstr(str)
+ y = convstr(str, flag)
+ </synopsis>
</refsynopsisdiv>
<?xml version="1.0" encoding="UTF-8"?>
-
<!--
* Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
* Copyright (C) INRIA
* along with this program.
*
-->
-
-<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" xmlns:scilab="http://www.scilab.org" xml:id="grep" xml:lang="ja">
-
+<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:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org"
+ xml:id="grep" xml:lang="ja">
<refnamediv>
-
<refname>grep</refname>
-
<refpurpose>文字列のベクトルの中で指定した文字列に一致するかどうかを調べる</refpurpose>
-
</refnamediv>
<refsynopsisdiv>
-
<title>呼び出し手順</title>
-
- <synopsis>row=grep(haystack,needle )
-
- [row,which]=grep(haystack,needle )
-
- row=grep(haystack,needle ,[flag])
-
- [row,which]=grep(haystack,needle ,[flag])
-
+ <synopsis>
+ [row, which] = grep(haystack, needle )
+ [row, which] = grep(haystack, needle, "regexp" )
</synopsis>
-
</refsynopsisdiv>
<refsection>
<varlistentry>
- <term>flag</term>
+ <term>"regexp" | "r" flag</term>
<listitem>
-
<para>
- 文字 (正規表現の場合は<literal>"r"</literal>)
+ single character: Then <varname>needle</varname> elements are used as
+ <emphasis role="bold">r</emphasis>egular expressions.
</para>
-
</listitem>
</varlistentry>
</refsection>
<refsection>
-
- <title>例 #1</title>
-
+ <title>例</title>
+ <para><emphasis role="bold">例 #1</emphasis></para>
<para>
-
以下の例では,<varname>txt</varname>変数に保存されている
-
テキスト中で,1つまたは2つの文字列を探します.
-
</para>
-
<programlisting role="example"><![CDATA[
txt=['find matches of a string in a vector of strings'
'search position of a character string in another string'
grep(txt,'strings')
grep(txt,['strings' 'Strings'])
[r,w]=grep(txt,['strings' 'Strings'])
- ]]></programlisting>
-
- </refsection>
-
- <refsection>
-
- <title>例 #2</title>
+ ]]></programlisting>
+ <para/>
+ <para><emphasis role="bold">例 #2</emphasis></para>
<para>以下の例では, 正規表現検索を行ないます.</para>
-
<programlisting role="example"><![CDATA[
str = ["hat";"cat";"hhat";"chat";"hcat";"ccchat";"at";"dog"]
grep(str,'/[hc]+at/','r')
grep(str,'/[hc]?at/','r')
grep(str,'/cat|dog/','r')
- ]]></programlisting>
+ ]]></programlisting>
</refsection>
<refsection role="see also">
-
<title>参照</title>
-
<simplelist type="inline">
-
<member>
-
<link linkend="strindex">strindex</link>
-
</member>
-
<member>
-
<link linkend="regexp">regexp</link>
-
</member>
-
+ <member>
+ <link linkend="find">find</link>
+ </member>
+ <member>
+ <link linkend="vectorfind">vectorfind</link>
+ </member>
</simplelist>
-
</refsection>
</refentry>
<?xml version="1.0" encoding="UTF-8"?>
-
<!--
* Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
* Copyright (C) INRIA -
- *
* Copyright (C) 2012 - 2016 - Scilab Enterprises
+ * Copyright (C) 2020 - Samuel GOUGEON
*
* This file is hereby licensed under the terms of the GNU GPL v2.0,
* pursuant to article 5.3.4 of the CeCILL v.2.1.
* along with this program.
*
-->
-
-<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:lang="ja" xml:id="isascii">
-
+<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns:svg="http://www.w3.org/2000/svg" xmlns:db="http://docbook.org/ns/docbook"
+ xmlns:scilab="http://www.scilab.org" xml:lang="ja" xml:id="isascii">
<refnamediv>
-
<refname>isascii</refname>
-
<refpurpose>文字が7ビットUS-ASCII文字であるかどうかを確認する</refpurpose>
-
</refnamediv>
-
<refsynopsisdiv>
-
<title>呼び出し手順</title>
-
<synopsis>res = isascii(str)</synopsis>
-
</refsynopsisdiv>
-
<refsection>
-
<title>引数</title>
-
<variablelist>
-
<varlistentry>
-
<term>str</term>
-
<listitem>
-
<para>文字列または整数の配列.</para>
-
</listitem>
-
</varlistentry>
-
<varlistentry>
-
<term>res</term>
-
<listitem>
-
<para>論理値行列.</para>
-
</listitem>
-
</varlistentry>
-
</variablelist>
-
</refsection>
-
<refsection>
-
<title>説明</title>
-
<para>
-
<code>res = isascii(str)</code>は,
-
<varname>str</varname>のエントリが
-
0および8進数表現で0177の間の7ビットUS-ASCII文字コード
-
(または<varname>str</varname>のエントリが7ビットUS-ASCII文字列)
-
の場合に<constant>%t</constant> (TRUE),
-
それ以外の場合に <constant>%f</constant> (FALSE).
-
</para>
-
</refsection>
-
<refsection>
-
<title>例</title>
-
<programlisting role="example"><![CDATA[
-letters = [115. 99. 105. 108. 97. 98.]
-isascii(letters)
-ascii(letters)
-isascii('scilab')
- ]]></programlisting>
-
+isascii("Señor")
+
+nt = ascii("Señor")
+isascii(nt)
+
+t = "We know that γ² = 1/(1-β²)";
+isascii(t)
+part(t, find(~isascii(t)))
+ ]]></programlisting>
+ <screen><![CDATA[
+--> isascii("Señor")
+ ans =
+ T T F T T
+
+--> nt = ascii("Señor")
+ nt =
+ 83. 101. 195. 177. 111. 114.
+
+--> isascii(nt)
+ ans =
+ T T F F T T
+
+
+--> t = "We know that γ² = 1/(1-β²)";
+--> isascii(t)
+ ans =
+ T T T T T T T T T T T T T F F T T T T T T T T F F T
+
+--> part(t, find(~isascii(t)))
+ ans =
+ "γ²β²"
+]]></screen>
+ <para>
+ Tabs, New lines, etc are special but anyway US-ascii characters.
+ Non-breakable spaces char(160) are not US-ascii:
+ </para>
+ <programlisting role="example"><![CDATA[
+t = "a" + char(160) + "b" + ascii(9) + " EOL:" + ascii(10) + "Next"
+isascii(t)
+ascii(t)
+ ]]></programlisting>
+ <screen><![CDATA[
+--> t = "a" + char(160) + "b" + ascii(9) + " EOL:" + ascii(10) + "Next"
+ t =
+ "a b EOL:
+Next"
+
+--> isascii(t)
+ ans =
+ T F T T T T T T T T T T T T
+
+--> ascii(t)
+ ans =
+ 97. 194. 160. 98. 9. 32. 69. 79. 76. 58. 10. 78. 101. 120. 116.
+]]></screen>
</refsection>
-
<refsection role="see also">
-
<title>参照</title>
-
<simplelist type="inline">
-
<member>
-
+ <link linkend="ascii">ascii</link>
+ </member>
+ <member>
<link linkend="isalphanum">isalphanum</link>
-
</member>
-
+ <member>
+ <link linkend="isdigit">isdigit</link>
+ </member>
+ <member>
+ <link linkend="isletter">isletter</link>
+ </member>
+ <member>
+ <link linkend="isnum">isnum</link>
+ </member>
</simplelist>
-
</refsection>
-
</refentry>
-
*
-->
-<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:lang="ja" xml:id="justify">
+<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns:svg="http://www.w3.org/2000/svg" xmlns:db="http://docbook.org/ns/docbook"
+ xmlns:scilab="http://www.scilab.org" xml:lang="ja" xml:id="justify">
<refnamediv>
<title>呼び出し手順</title>
- <synopsis>Tj = justify(T, opt)</synopsis>
+ <synopsis>Tj = justify(T, position)</synopsis>
</refsynopsisdiv>
<varlistentry>
- <term>opt</term>
+ <term>position</term>
<listitem>
- <para>文字オプション,以下の値を指定できます:</para>
-
- <variablelist>
-
- <varlistentry>
-
- <term>'r'または'right'</term>
-
- <listitem>
-
- <para>右揃え</para>
-
- </listitem>
-
- </varlistentry>
-
- <varlistentry>
-
- <term>'l'または'left' </term>
-
- <listitem>
-
- <para>左揃え</para>
-
- </listitem>
-
- </varlistentry>
-
- <varlistentry>
-
- <term>'c'または'center' </term>
-
- <listitem>
-
- <para>中央揃え</para>
-
- </listitem>
-
- </varlistentry>
-
- </variablelist>
-
+ <para>以下の値を指定できます:
+ <table cellspacing="0" cellpadding="0">
+ <tr><td><term>'l'または'left'</term></td><td>: 左揃え</td></tr>
+ <tr><td><term>'c'または'center'</term></td><td>: 中央揃え</td></tr>
+ <tr><td><term>'r'または'right'</term></td><td>: 右揃え</td></tr>
+ </table>
+ </para>
</listitem>
</varlistentry>
<function>justify</function>関数は,
- 指定したオプション<varname>opt</varname>に基づき
+ 指定したオプション<varname>position</varname>に基づき
文字列の行列の列を整列します.
* along with this program.
*
-->
-<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns4="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="regexp" xml:lang="ja">
+<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns4="http://www.w3.org/1999/xhtml"
+ xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org"
+ xml:id="regexp" xml:lang="ja">
<refnamediv>
<refname>regexp</refname>
<refpurpose>正規表現文字列に一致する部分文字列を探す</refpurpose>
<refsynopsisdiv>
<title>呼び出し手順</title>
<synopsis>
- [start] = regexp(input, pattern, [flag])
- [start, final] = regexp(input, pattern, [flag])
- [start, final, match] = regexp(input, pattern, [flag])
- [start, final, match, foundString] = regexp(input, pattern, [flag])
+ [start, final, match, foundString] = regexp(input, pattern)
+ [start, final, match, foundString] = regexp(input, pattern, "once")
</synopsis>
</refsynopsisdiv>
<refsection>
</listitem>
</varlistentry>
<varlistentry>
- <term>[flag]</term>
+ <term>"once" | "o" flag</term>
<listitem>
<para>
パターンに一回マッチする場合は,<literal>'o'</literal>.
*
-->
-<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" xmlns:scilab="http://www.scilab.org" xml:id="strcat" xml:lang="ja">
+<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:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org"
+ xml:id="strcat" xml:lang="ja">
<refnamediv>
<title>呼び出し手順</title>
<synopsis>
-
- txt = strcat(strings [,string_added])
-
- txt = strcat(strings [,string_added, ["flag"]])
-
+ txt = strcat(strings)
+ txt = strcat(strings, string_added)
+ txt = strcat(strings, string_added, "r")
+ txt = strcat(strings, string_added, "c")
</synopsis>
</refsynopsisdiv>
<varlistentry>
- <term>"flag"</term>
+ <term>"e" | "c" flag</term>
<listitem>
<link linkend="strings">strings</link>
</member>
+ <member>
+ <link linkend="strsplit">strsplit</link>
+ </member>
+ <member>
+ <link linkend="brackets">brackets []</link>
+ </member>
</simplelist>
* along with this program.
*
-->
-<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns4="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="strcmp" xml:lang="ja">
+<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns4="http://www.w3.org/1999/xhtml"
+ xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org"
+ xml:id="strcmp" xml:lang="ja">
<refnamediv>
<refname>strcmp</refname>
<refpurpose>文字列を比較</refpurpose>
</refnamediv>
<refsynopsisdiv>
<title>呼び出し手順</title>
- <synopsis>res = strcmp(string_one, string_two, [,'i'])</synopsis>
+ <synopsis>
+ res = strcmp(string_one, string_two)
+ res = strcmp(string_one, string_two, "i")
+ </synopsis>
</refsynopsisdiv>
<refsection>
<title>引数</title>
*
-->
-<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns4="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="strcspn" xml:lang="ja">
-
+<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns4="http://www.w3.org/1999/xhtml"
+ xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org"
+ xml:id="strcspn" xml:lang="ja">
<refnamediv>
-
<refname>strcspn</refname>
-
- <refpurpose>文字列の中の文字までの間隔を得る</refpurpose>
-
+ <refpurpose>
+ lengths from the beginning of texts until a character among those prohibited
+ </refpurpose>
</refnamediv>
-
<refsynopsisdiv>
-
<title>Syntax</title>
-
<synopsis>res = strcspn(string_one, string_two)</synopsis>
-
</refsynopsisdiv>
-
<refsection>
<title>引数</title>
*
-->
-<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns4="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="strindex" xml:lang="ja">
+<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns4="http://www.w3.org/1999/xhtml"
+ xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org"
+ xml:id="strindex" xml:lang="ja">
<refnamediv>
<refsynopsisdiv>
<title>呼び出し手順</title>
-
<synopsis>
-
- ind = strindex(haystack, needle, [flag])
-
- [ind, which] = strindex(haystack, needle, [flag])
-
+ [ind, which] = strindex(haystack, needle)
+ [ind, which] = strindex(haystack, needle, "regexp")
</synopsis>
-
</refsynopsisdiv>
<refsection>
<varlistentry>
- <term>flag</term>
-
+ <term>"regexp" | "r" flag</term>
<listitem>
-
<para>
- 文字列(<literal>"r"</literal>の場合は正規表現)
+ 次に、<varname>needle</varname>要素が正規表現として使用されます.
</para>
-
</listitem>
</varlistentry>
<?xml version="1.0" encoding="UTF-8"?>
-
<!--
* Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
* Copyright (C) INRIA -
- *
* Copyright (C) 2012 - 2016 - Scilab Enterprises
+ * Copyright (C) 2020 - Samuel GOUGEON
*
* This file is hereby licensed under the terms of the GNU GPL v2.0,
* pursuant to article 5.3.4 of the CeCILL v.2.1.
* along with this program.
*
-->
-
-<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns4="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="strspn" xml:lang="ja">
-
+<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns4="http://www.w3.org/1999/xhtml"
+ xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org"
+ xml:id="strspn" xml:lang="ja">
<refnamediv>
-
<refname>strspn</refname>
-
- <refpurpose>文字列において指定した文字集合の幅を取得</refpurpose>
-
+ <refpurpose>
+ lengths of the beginning of texts as long as characters are among those allowed
+ </refpurpose>
</refnamediv>
-
<refsynopsisdiv>
-
<title>呼び出し手順</title>
-
- <synopsis>res = strspn(str1, str2)</synopsis>
-
+ <synopsis>headsLengths = strspn(Texts, allowedChars)</synopsis>
</refsynopsisdiv>
-
<refsection>
-
<title>引数</title>
-
<variablelist>
-
- <varlistentry>
-
- <term>str1</term>
-
- <listitem>
-
- <para>文字列または文字列の行列</para>
-
- </listitem>
-
- </varlistentry>
-
- <varlistentry>
-
- <term>str2</term>
-
- <listitem>
-
- <para>文字列または文字列の行列</para>
-
- </listitem>
-
- </varlistentry>
-
<varlistentry>
-
- <term>res</term>
-
+ <term>Texts, allowedChars, headsLengths</term>
<listitem>
-
- <para>文字列の行列.</para>
-
+ <para>
+ Matrices of texts, of identical dimensions.
+ <varname>allowedChars</varname> can be a scalar string.
+ It is then used for all <varname>Texts</varname> components.
+ </para>
</listitem>
-
</varlistentry>
-
</variablelist>
-
</refsection>
-
<refsection>
-
<title>説明</title>
-
- <para>
-
- <code>res = strspn(str1, str2)</code>は,
-
- <varname>str2</varname>に含まれる文字のみからなる
-
- <varname>str1</varname>の先頭部分の長さを返します.
-
- </para>
-
<para>
-
- <varname>str1</varname>は<varname>str2</varname>と次元が同じ,
-
- もしくは,
-
- <varname>str2</varname>が1x1の文字列である必要があります.
-
- どちらの場合でも,
-
- 出力は<varname>str1</varname>と同じ次元となります.
-
+ <literal>headsLengths = strspn(Texts, allowedChars)</literal>は,
+ <varname>allowedChars</varname>に含まれる文字のみからなる
+ <varname>Texts</varname>の先頭部分の長さを返します.
</para>
-
</refsection>
-
<refsection>
-
<title>例</title>
-
<programlisting role="example"><![CDATA[
-i = strspn("129th","1234567890");
-mprintf ("The length of initial number is %d.\n",i);
-i = strspn(["129th","130th"],["1234567890","130t"])
+allowed = "0":"9"
+strspn("129th or the 130th", allowed)
+
+t = ["characters" "matrix" ; "text" "strings"]
+allowed = "a":"s"
+strspn(t, allowed)
+
+allowed = ["a":"j", "a":"u" ; "d":"u", "g":"v"]
+strspn(t, allowed)
+ ]]></programlisting>
+ <screen><![CDATA[
+--> allowed = "0":"9"
+ allowed =
+ "0123456789"
+
+--> strspn("129th or the 130th", allowed)
+ ans =
+ 3.
+
+
+--> t = ["characters" "matrix" ; "text" "strings"]
+ t =
+ "characters" "matrix"
+ "text" "strings"
+
+--> allowed = "a":"s"
+ allowed =
+ "abcdefghijklmnopqrs"
+--> strspn(t, allowed)
+ ans =
+ 6. 2.
+ 0. 1.
+
+--> allowed = ["a":"j", "a":"u" ; "d":"u", "g":"v"]
+ allowed =
+ "abcdefghij" "abcdefghijklmnopqrstu"
+ "defghijklmnopqrstu" "ghijklmnopqrstuv"
+
+--> strspn(t, allowed)
+ ans =
+ 3. 5.
+ 2. 7.
+]]></screen>
+ <para>
+ With UTF-8 extended characters:
+ </para>
+ <programlisting role="example"><![CDATA[
+t = "Να αμφιβάλλετε τα πάντα ή να μην αμφιβάλλετε τίποτα: " + ..
+ "δύο ίσοι τρόποι αποφυγής σκέψης.";
+t = matrix(strsplit(t," "), 2,-1)
+allowed = "Ναβγδεϵζηθικλμνξοπρστυφϕχψωϐϑϰϱςϖ";
+strspn(t, allowed)
]]></programlisting>
-
+ <screen><![CDATA[
+--> t = matrix(strsplit(t," "), 2,-1)
+ t =
+ "Να" "τα" "ή" "μην" "τίποτα:" "ίσοι" "αποφυγής"
+ "αμφιβάλλετε" "πάντα" "να" "αμφιβάλλετε" "δύο" "τρόποι" "σκέψης."
+
+--> allowed = "Ναβγδεϵζηθικλμνξοπρστυφϕχψωϐϑϰϱςϖ";
+--> strspn(t, allowed)
+ ans =
+ 2. 2. 0. 3. 1. 0. 6.
+ 5. 1. 2. 5. 1. 2. 2.
+]]></screen>
</refsection>
-
<refsection role="see also">
-
<title>参照</title>
-
<simplelist type="inline">
-
<member>
-
<link linkend="strcspn">strcspn</link>
-
</member>
-
+ <member>
+ <link linkend="strncpy">strncpy</link>
+ </member>
+ <member>
+ <link linkend="part">part</link>
+ </member>
</simplelist>
-
</refsection>
-
-</refentry>
-
+</refentry>
\ No newline at end of file
*
-->
-<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" xmlns:scilab="http://www.scilab.org" xml:id="strsubst" xml:lang="ja">
+<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:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org"
+ xml:id="strsubst" xml:lang="ja">
<refnamediv>
<refsynopsisdiv>
<title>呼び出し手順</title>
-
<synopsis>
-
string_out = strsubst(string_in, searchStr, replaceStr)
-
- string_out = strsubst(string_in, searchStr, replaceStr, [flag])
-
+ string_out = strsubst(string_in, searchStr, replaceStr, "regexp")
</synopsis>
-
</refsynopsisdiv>
<refsection>
<varlistentry>
- <term>flag</term>
+ <term>"regexp" | "r" flag</term>
<listitem>
<para>
- 文字列 (正規表現の場合は<literal>"r"</literal>)
+ 次に、<varname>searchStr</varname>が正規表現として使用されます.
</para>
</listitem>
*
-->
-<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:lang="ja" xml:id="tokenpos">
+<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns:svg="http://www.w3.org/2000/svg" xmlns:db="http://docbook.org/ns/docbook"
+ xmlns:scilab="http://www.scilab.org" xml:lang="ja" xml:id="tokenpos">
<refnamediv>
<refsynopsisdiv>
<title>呼び出し手順</title>
-
- <synopsis>kdf = tokenpos(str [,delimiter])</synopsis>
-
+ <synopsis>
+ kdf = tokenpos(str)
+ kdf = tokenpos(str, delimiter)
+ </synopsis>
</refsynopsisdiv>
<refsection>
<?xml version="1.0" encoding="UTF-8"?>
-
<!--
* Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
* Copyright (C) INRIA -
- *
* Copyright (C) 2012 - 2016 - Scilab Enterprises
+ * Copyright (C) 2020 - Samuel GOUGEON
*
* This file is hereby licensed under the terms of the GNU GPL v2.0,
* pursuant to article 5.3.4 of the CeCILL v.2.1.
* along with this program.
*
-->
-
-<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:lang="ja" xml:id="tokens">
-
+<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns:svg="http://www.w3.org/2000/svg" xmlns:mml="http://www.w3.org/1998/Math/MathML"
+ xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org"
+ xml:lang="ja" xml:id="tokens">
<refnamediv>
-
<refname>tokens</refname>
-
- <refpurpose>文字列のトークンを返す.</refpurpose>
-
+ <refpurpose>セパレータを使用してテキストをチャンクに分割する</refpurpose>
</refnamediv>
-
<refsynopsisdiv>
-
<title>呼び出し手順</title>
-
- <synopsis>T = tokens(str [,delimiter])</synopsis>
-
+ <synopsis>
+ Chunks = tokens(text)
+ Chunks = tokens(text, separators)
+ </synopsis>
</refsynopsisdiv>
-
<refsection>
-
<title>引数</title>
-
<variablelist>
-
<varlistentry>
-
- <term>str</term>
-
+ <term>text</term>
<listitem>
-
- <para>文字列. トークンを探す文字列.</para>
-
+ 分割する単一のテキスト. 拡張UTF-8国際文字を含めることができます.
+ <para/>
</listitem>
-
</varlistentry>
-
<varlistentry>
-
- <term>delimiter</term>
-
+ <term>separators</term>
<listitem>
-
- <para>(オプション) 文字または文字のベクトル. トークンデリミタ.</para>
-
+ 文字または文字のベクトル. トークンデリミタ. Default value =
+ <literal>[" ", ascii(9)]</literal>, ascii(9) being the horizontal tab.
+ <para/>
</listitem>
-
</varlistentry>
-
<varlistentry>
-
- <term>T</term>
-
+ <term>Chunks</term>
<listitem>
-
- <para>みつかったトークンの列ベクトル</para>
-
+ みつかったトークンの列ベクトル
+ <para/>
</listitem>
-
</varlistentry>
-
</variablelist>
-
</refsection>
-
<refsection>
-
<title>説明</title>
-
<para>
+ <literal>tokens(…)</literal> は,
+ 文字列<varname>text</varname>の中に含まれるトークンを探します.
- <code>T = tokens(str [,delimiter]) </code> は,
+ <literal>tokens(…)</literal>は,テキストでセパレータを検索し,それをチャンクに分割します.
+ チャンクにはセパレータがありません. 連続する区切り文字がマージされます.
+ </para>
+ </refsection>
+ <refsection>
+ <title>例</title>
+ <programlisting role="example"><![CDATA[
+tokens("The given text")
- 文字列<varname>str</varname>の中に含まれるトークンを探します.
+tokens("SCI/demos/scicos", "/")'
- <varname>delimiter</varname>のデフォルト値は
+tokens("Επιστήμη και καινοτομία", ["α"," "])'
- <literal>[" ",<Tab>]</literal>です.
+nbsp = ascii(160); // non-breakable space
+t = "the" + nbsp + "given text"
+tokens(t)
+ ]]></programlisting>
+ <screen><![CDATA[
+--> tokens('The given text')
+ ans =
+ "The"
+ "given"
+ "text"
- ただし, <Tab> は<code>ascii(9)</code>を意味します.
- </para>
+--> tokens('SCI/demos/scicos', '/')'
+ ans =
+ "SCI" "demos" "scicos"
- </refsection>
- <refsection>
+--> tokens("Επιστήμη και καινοτομία", ["α"," "])'
+ ans =
+ "Επιστήμη" "κ" "ι" "κ" "ινοτομί"
- <title>例</title>
- <programlisting role="example"><![CDATA[
-tokens('This is a character string')
-tokens('SCI/demos/scicos','/')
-tokens('y=a+b*2',['=','+','*'])
- ]]></programlisting>
+--> nbsp = ascii(160); // non-breakable space
+--> t = "the" + nbsp + "given text"
+ t =
+ "the given text"
+--> tokens(t)
+ ans =
+ "the given"
+ "text"
+]]></screen>
</refsection>
-
<refsection role="see also">
-
<title>参照</title>
-
<simplelist type="inline">
-
<member>
-
+ <link linkend="strsplit">strsplit</link>
+ </member>
+ <member>
+ <link linkend="regexp">regexp</link>
+ </member>
+ <member>
<link linkend="strindex">strindex</link>
-
</member>
-
<member>
-
<link linkend="tokenpos">tokenpos</link>
-
</member>
-
</simplelist>
-
</refsection>
-
-</refentry>
-
+</refentry>
\ No newline at end of file
* along with this program.
*
-->
-<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" xmlns:scilab="http://www.scilab.org" xml:id="convstr" xml:lang="pt">
+<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:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org"
+ xml:id="convstr" xml:lang="pt">
<refnamediv>
<refname>convstr</refname>
<refpurpose>conversão maiúsculas-minúsculas,
</refnamediv>
<refsynopsisdiv>
<title>Seqüência de Chamamento</title>
- <synopsis>[y]=convstr(str, [flag])</synopsis>
+ <synopsis>
+ y = convstr(str)
+ y = convstr(str, flag)
+ </synopsis>
</refsynopsisdiv>
<refsection>
<title>Parâmetros</title>
* along with this program.
*
-->
-<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns4="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="grep" xml:lang="pt">
+<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns4="http://www.w3.org/1999/xhtml"
+ xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org"
+ xml:id="grep" xml:lang="pt">
<refnamediv>
<refname>grep</refname>
<refpurpose>acha correspondências de um string em um vetor de
</refnamediv>
<refsynopsisdiv>
<title>Seqüência de Chamamento</title>
- <synopsis>row=grep(haystack,needle )
- [row,which]=grep(haystack,needle )
- row=grep(haystack,needle ,[flag])
- [row,which]=grep(haystack,needle ,[flag])
+ <synopsis>
+ [row, which] = grep(haystack, needle )
+ [row, which] = grep(haystack, needle, "regexp" )
</synopsis>
</refsynopsisdiv>
<refsection>
</listitem>
</varlistentry>
<varlistentry>
- <term>flag</term>
+ <term>"regexp" | "r" flag</term>
<listitem>
- <para>caractere ("r" para expressão regular)</para>
+ <para>
+ caractere único: Em seguida, os elementos <varname>needle</varname> são
+ usados como expressões <emphasis role="bold">r</emphasis>egulares.
+ </para>
</listitem>
</varlistentry>
</variablelist>
<member>
<link linkend="strindex">strindex</link>
</member>
+ <member>
+ <link linkend="regexp">regexp</link>
+ </member>
+ <member>
+ <link linkend="find">find</link>
+ </member>
+ <member>
+ <link linkend="vectorfind">vectorfind</link>
+ </member>
</simplelist>
</refsection>
</refentry>
<!--
* Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
* Copyright (C) INRIA -
- *
* Copyright (C) 2012 - 2016 - Scilab Enterprises
+ * Copyright (C) 2020 - Samuel GOUGEON
*
* This file is hereby licensed under the terms of the GNU GPL v2.0,
* pursuant to article 5.3.4 of the CeCILL v.2.1.
* along with this program.
*
-->
-<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns3="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="isascii" xml:lang="pt">
+<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns3="http://www.w3.org/1999/xhtml"
+ xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:scilab="http://www.scilab.org"
+ xml:id="isascii" xml:lang="pt">
<refnamediv>
<refname>isascii</refname>
- <refpurpose>verifica se um caractere é do tipo 7-bit US-ASCII</refpurpose>
+ <refpurpose>
+ Testa se cada caractere de strings fornecidas é do tipo 7-bit US-ASCII
+ </refpurpose>
</refnamediv>
<refsynopsisdiv>
<title>Seqüência de Chamamento</title>
<refsection>
<title>Exemplos</title>
<programlisting role="example"><![CDATA[
-letters = [115. 99. 105. 108. 97. 98.]
-isascii(letters)
-ascii(letters)
-isascii('scilab')
- ]]></programlisting>
+isascii("Señor")
+
+nt = ascii("Señor")
+isascii(nt)
+
+t = "We know that γ² = 1/(1-β²)";
+isascii(t)
+part(t, find(~isascii(t)))
+ ]]></programlisting>
+ <screen><![CDATA[
+--> isascii("Señor")
+ ans =
+ T T F T T
+
+--> nt = ascii("Señor")
+ nt =
+ 83. 101. 195. 177. 111. 114.
+
+--> isascii(nt)
+ ans =
+ T T F F T T
+
+
+--> t = "We know that γ² = 1/(1-β²)";
+--> isascii(t)
+ ans =
+ T T T T T T T T T T T T T F F T T T T T T T T F F T
+
+--> part(t, find(~isascii(t)))
+ ans =
+ "γ²β²"
+]]></screen>
+ <para>
+ Tabs, New lines, etc are special but anyway US-ascii characters.
+ Non-breakable spaces char(160) are not US-ascii:
+ </para>
+ <programlisting role="example"><![CDATA[
+t = "a" + char(160) + "b" + ascii(9) + " EOL:" + ascii(10) + "Next"
+isascii(t)
+ascii(t)
+ ]]></programlisting>
+ <screen><![CDATA[
+--> t = "a" + char(160) + "b" + ascii(9) + " EOL:" + ascii(10) + "Next"
+ t =
+ "a b EOL:
+Next"
+
+--> isascii(t)
+ ans =
+ T F T T T T T T T T T T T T
+
+--> ascii(t)
+ ans =
+ 97. 194. 160. 98. 9. 32. 69. 79. 76. 58. 10. 78. 101. 120. 116.
+]]></screen>
</refsection>
<refsection role="see also">
<title>Ver Também</title>
<simplelist type="inline">
<member>
+ <link linkend="ascii">ascii</link>
+ </member>
+ <member>
<link linkend="isalphanum">isalphanum</link>
</member>
+ <member>
+ <link linkend="isdigit">isdigit</link>
+ </member>
+ <member>
+ <link linkend="isletter">isletter</link>
+ </member>
+ <member>
+ <link linkend="isnum">isnum</link>
+ </member>
</simplelist>
</refsection>
</refentry>
* along with this program.
*
-->
-<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" xmlns:scilab="http://www.scilab.org" xml:id="justify" xml:lang="pt">
+<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:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org"
+ xml:id="justify" xml:lang="pt">
<refnamediv>
<refname>justify</refname>
- <refpurpose>justifica um array de caracteres</refpurpose>
+ <refpurpose>Alinha o texto nas colunas à esquerda, centro ou direita</refpurpose>
</refnamediv>
<refsynopsisdiv>
<title>Seqüência de Chamamento</title>
- <synopsis>Tj=justify(T,opt)</synopsis>
+ <synopsis>Tj = justify(T, position)</synopsis>
</refsynopsisdiv>
<refsection>
<title>Parâmetros</title>
</listitem>
</varlistentry>
<varlistentry>
- <term>opt</term>
+ <term>position</term>
<listitem>
- <para>opção com possíveis valores</para>
- <variablelist>
- <varlistentry>
- <term>'r'</term>
- <listitem>
- <para>ou 'right' para justificação direita</para>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term>'l'</term>
- <listitem>
- <para>ou 'left' para justificação esquerda</para>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term>'c'</term>
- <listitem>
- <para>ou 'center' justificação centrada</para>
- </listitem>
- </varlistentry>
- </variablelist>
+ <para>Possíveis valores :
+ <table cellspacing="0" cellpadding="0">
+ <tr><td><term>'l' ou 'left'</term></td><td>: justificação esquerda</td></tr>
+ <tr><td><term>'c' ou 'center'</term></td><td>: justificação centrada</td></tr>
+ <tr><td><term>'r' ou 'right'</term></td><td>: justificação direita</td></tr>
+ </table>
+ </para>
</listitem>
</varlistentry>
</variablelist>
<title>Descrição</title>
<para>
<literal>justify</literal> justifica a coluna de uma matriz de
- strings de acordo com a opção dada.
+ strings de acordo com o <varname>position</varname>.
</para>
</refsection>
<refsection>
* along with this program.
*
-->
-<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" xmlns:scilab="http://www.scilab.org" xml:id="length" xml:lang="pt">
+<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:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org"
+ xml:id="length" xml:lang="pt">
<refnamediv>
<refname>length</refname>
- <refpurpose>comprimento de um objeto</refpurpose>
+ <refpurpose>
+ Número de caracteres de um texto. Número de elementos de uma matriz ou lista.
+ </refpurpose>
</refnamediv>
<refsynopsisdiv>
<title>Seqüência de Chamamento</title>
* along with this program.
*
-->
-<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns4="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="regexp" xml:lang="pt">
+<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns4="http://www.w3.org/1999/xhtml"
+ xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org"
+ xml:id="regexp" xml:lang="pt">
<refnamediv>
<refname>regexp</refname>
<refpurpose>acha um string que corresponde ao string de expressão
</refnamediv>
<refsynopsisdiv>
<title>Seqüência de Chamamento</title>
- <synopsis>[start]=regexp(input,pattern,[flag])
- [start,end,match]=regexp(input,pattern,[flag])
- [start,end]=regexp(input,pattern,[flag])
- [start,end,match]=regexp(input,pattern,[flag])
+ <synopsis>
+ [start, final, match, foundString] = regexp(input, pattern)
+ [start, final, match, foundString] = regexp(input, pattern, "once")
</synopsis>
</refsynopsisdiv>
<refsection>
</listitem>
</varlistentry>
<varlistentry>
- <term>[flag]</term>
+ <term>"once | "o" flag</term>
<listitem>
- <para>'o' para correspondência com padrão uma vez</para>
+ <para>'o' para correspondência com padrão apenas uma vez</para>
</listitem>
</varlistentry>
</variablelist>
* along with this program.
*
-->
-<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" xmlns:scilab="http://www.scilab.org" xml:id="strcat" xml:lang="pt">
+<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:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org"
+ xml:id="strcat" xml:lang="pt">
<refnamediv>
<refname>strcat</refname>
<refpurpose>concatena strings</refpurpose>
</refnamediv>
<refsynopsisdiv>
<title>Seqüência de Chamamento</title>
- <synopsis>txt=strcat(vector_of_strings [,string_added])
- txt=strcat(vector_of_strings [,string_added, ["flag"]])
+ <synopsis>
+ txt = strcat(strings)
+ txt = strcat(strings, string_added)
+ txt = strcat(strings, string_added, "r")
+ txt = strcat(strings, string_added, "c")
</synopsis>
</refsynopsisdiv>
<refsection>
</listitem>
</varlistentry>
<varlistentry>
- <term>"flag"</term>
+ <term>"r" | "c" flag</term>
<listitem>
- <para>string ( "r" para retornar uma matriz linha, "c" para
- retornar uma matriz coluna)
+ <para>
+ <literal>"r"</literal> cola todas as linhas de cada coluna, no
+ array <varname> strings </varname>.
+ <literal>"c"</literal> cola todas as colunas em cada linha.
</para>
</listitem>
</varlistentry>
<member>
<link linkend="strings">strings</link>
</member>
+ <member>
+ <link linkend="strsplit">strsplit</link>
+ </member>
+ <member>
+ <link linkend="brackets">brackets []</link>
+ </member>
</simplelist>
</refsection>
</refentry>
</refnamediv>
<refsynopsisdiv>
<title>Seqüência de Chamamento</title>
- <synopsis>res = strcmp(string_one,string_two,[,'i'])</synopsis>
+ <synopsis>
+ res = strcmp(string_one, string_two)
+ res = strcmp(string_one, string_two, "i")
+ </synopsis>
</refsynopsisdiv>
<refsection>
<title>Parâmetros</title>
* along with this program.
*
-->
-<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns4="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="strcspn" xml:lang="pt">
+<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns4="http://www.w3.org/1999/xhtml"
+ xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org"
+ xml:id="strcspn" xml:lang="pt">
<refnamediv>
<refname>strcspn</refname>
- <refpurpose>retorna extensão até um caractere em um string</refpurpose>
+ <refpurpose>
+ comprimentos do início dos textos até que um caractere entre aqueles proibidos
+ </refpurpose>
</refnamediv>
<refsynopsisdiv>
<title>Seqüência de Chamamento</title>
* along with this program.
*
-->
-<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns4="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="strindex" xml:lang="pt">
+<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns4="http://www.w3.org/1999/xhtml"
+ xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org"
+ xml:id="strindex" xml:lang="pt">
<refnamediv>
<refname>strindex</refname>
<refpurpose>procura posição de um string em outro</refpurpose>
</refnamediv>
<refsynopsisdiv>
<title>Seqüência de Chamamento</title>
- <synopsis>ind=strindex(haystack,needle,[flag])
- [ind,which]=strindex(haystack,needle,[flag])
+ <synopsis>
+ [ind, which] = strindex(haystack, needle)
+ [ind, which] = strindex(haystack, needle, "regexp")
</synopsis>
</refsynopsisdiv>
<refsection>
</listitem>
</varlistentry>
<varlistentry>
- <term>flag</term>
+ <term>"regexp" | "r" flag</term>
<listitem>
- <para>string ("r" para expressão regular)</para>
+ <para>Em seguida, os elementos <varname>needle</varname> são usados como
+ expressões regulares.
+ </para>
</listitem>
</varlistentry>
</variablelist>
* along with this program.
*
-->
-<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" xmlns:scilab="http://www.scilab.org" xml:id="strncpy" xml:lang="pt">
+<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:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org"
+ xml:id="strncpy" xml:lang="pt">
<refnamediv>
<refname>strncpy</refname>
- <refpurpose>copia caracteres de strings</refpurpose>
+ <refpurpose>Obtém e fornece os N primeiros caracteres dos textos fornecidos</refpurpose>
</refnamediv>
<refsynopsisdiv>
<title>Seqüência de Chamamento</title>
<!--
* Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
* Copyright (C) INRIA -
- *
* Copyright (C) 2012 - 2016 - Scilab Enterprises
+ * Copyright (C) 2020 - Samuel GOUGEON
*
* This file is hereby licensed under the terms of the GNU GPL v2.0,
* pursuant to article 5.3.4 of the CeCILL v.2.1.
* along with this program.
*
-->
-<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns4="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="strspn" xml:lang="pt">
+<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns4="http://www.w3.org/1999/xhtml"
+ xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org"
+ xml:id="strspn" xml:lang="pt">
<refnamediv>
<refname>strspn</refname>
- <refpurpose>retorna a extensão do conjunto de caracteres no
- string
+ <refpurpose>
+ comprimentos do início dos textos, desde que os caracteres estejam entre os permitidos
</refpurpose>
</refnamediv>
<refsynopsisdiv>
<title>Seqüência de Chamamento</title>
- <synopsis>res = strspn(str1,str2)</synopsis>
+ <synopsis>headsLengths = strspn(Texts, allowedChars)</synopsis>
</refsynopsisdiv>
<refsection>
<title>Parâmetros</title>
<variablelist>
<varlistentry>
- <term>str1</term>
- <listitem>
- <para>string ou matriz de strings</para>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term>str2</term>
- <listitem>
- <para>string ou matriz de strings</para>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term>res</term>
+ <term>Texts, allowedChars, headsLengths</term>
<listitem>
- <para>matriz</para>
+ <para>
+ Matrices of texts, of identical dimensions.
+ <varname>allowedChars</varname> can be a scalar string.
+ It is then used for all <varname>Texts</varname> components.
+ </para>
</listitem>
</varlistentry>
</variablelist>
<refsection>
<title>Descrição</title>
<para>
- <literal>res = strspn(str1,str2)</literal> retorna o comprimento da
- porção inicial de str1 que consiste apenas de caracteres que fazem parte
- de str2.
- </para>
- <para>str2 deve ter as mesmas dimensões que str2, ou str1 pode ser um
- string.
+ <literal>headsLengths = strspn(Texts,allowedChars)</literal> retorna o comprimento da
+ porção inicial de <varname>Texts</varname> que consiste apenas de caracteres que
+ fazem parte de <varname>allowedChars</varname>.
</para>
</refsection>
<refsection>
<title>Exemplos</title>
<programlisting role="example"><![CDATA[
-i = strspn("129o","1234567890");
-mprintf ("O comprimento do numero inicial e %d.\n",i);
-i = strspn(["129o","130o"],["1234567890","130o"])
+allowed = "0":"9"
+strspn("129th or the 130th", allowed)
+
+t = ["characters" "matrix" ; "text" "strings"]
+allowed = "a":"s"
+strspn(t, allowed)
+
+allowed = ["a":"j", "a":"u" ; "d":"u", "g":"v"]
+strspn(t, allowed)
+ ]]></programlisting>
+ <screen><![CDATA[
+--> allowed = "0":"9"
+ allowed =
+ "0123456789"
+
+--> strspn("129th or the 130th", allowed)
+ ans =
+ 3.
+
+
+--> t = ["characters" "matrix" ; "text" "strings"]
+ t =
+ "characters" "matrix"
+ "text" "strings"
+
+--> allowed = "a":"s"
+ allowed =
+ "abcdefghijklmnopqrs"
+--> strspn(t, allowed)
+ ans =
+ 6. 2.
+ 0. 1.
+
+--> allowed = ["a":"j", "a":"u" ; "d":"u", "g":"v"]
+ allowed =
+ "abcdefghij" "abcdefghijklmnopqrstu"
+ "defghijklmnopqrstu" "ghijklmnopqrstuv"
+
+--> strspn(t, allowed)
+ ans =
+ 3. 5.
+ 2. 7.
+]]></screen>
+ <para>
+ With UTF-8 extended characters:
+ </para>
+ <programlisting role="example"><![CDATA[
+t = "Να αμφιβάλλετε τα πάντα ή να μην αμφιβάλλετε τίποτα: " + ..
+ "δύο ίσοι τρόποι αποφυγής σκέψης.";
+t = matrix(strsplit(t," "), 2,-1)
+allowed = "Ναβγδεϵζηθικλμνξοπρστυφϕχψωϐϑϰϱςϖ";
+strspn(t, allowed)
]]></programlisting>
+ <screen><![CDATA[
+--> t = matrix(strsplit(t," "), 2,-1)
+ t =
+ "Να" "τα" "ή" "μην" "τίποτα:" "ίσοι" "αποφυγής"
+ "αμφιβάλλετε" "πάντα" "να" "αμφιβάλλετε" "δύο" "τρόποι" "σκέψης."
+
+--> allowed = "Ναβγδεϵζηθικλμνξοπρστυφϕχψωϐϑϰϱςϖ";
+--> strspn(t, allowed)
+ ans =
+ 2. 2. 0. 3. 1. 0. 6.
+ 5. 1. 2. 5. 1. 2. 2.
+]]></screen>
</refsection>
<refsection role="see also">
<title>Ver Também</title>
<member>
<link linkend="strcspn">strcspn</link>
</member>
+ <member>
+ <link linkend="strncpy">strncpy</link>
+ </member>
+ <member>
+ <link linkend="part">part</link>
+ </member>
</simplelist>
</refsection>
</refentry>
* along with this program.
*
-->
-<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" xmlns:scilab="http://www.scilab.org" xml:id="strsubst" xml:lang="pt">
+<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:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org"
+ xml:id="strsubst" xml:lang="pt">
<refnamediv>
<refname>strsubst</refname>
<refpurpose>substitui um string por outro dentro de um string</refpurpose>
</refnamediv>
<refsynopsisdiv>
<title>Seqüência de Chamamento</title>
- <synopsis>string_out=strsubst(string_in,searchStr,replaceStr)
- string_out=strsubst(string_in,searchStr,replaceStr,[flag])
+ <synopsis>
+ string_out = strsubst(string_in, searchStr, replaceStr)
+ string_out = strsubst(string_in, searchStr, replaceStr, "regexp")
</synopsis>
</refsynopsisdiv>
<refsection>
</listitem>
</varlistentry>
<varlistentry>
- <term>flag</term>
+ <term>"regexp" | "r" flag</term>
<listitem>
- <para>string ("r" para expressão regular)</para>
+ <para>
+ Em seguida, <varname>searchStr</varname> é usado como uma expressão regular.
+ </para>
</listitem>
</varlistentry>
</variablelist>
* along with this program.
*
-->
-<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns4="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="tokenpos" xml:lang="pt">
+<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns4="http://www.w3.org/1999/xhtml"
+ xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org"
+ xml:id="tokenpos" xml:lang="pt">
<refnamediv>
<refname>tokenpos</refname>
<refpurpose>retorna as posições das fichas (token) em um
</refnamediv>
<refsynopsisdiv>
<title>Seqüência de Chamamento</title>
- <synopsis>kdf=tokenpos(str [,delimiter])</synopsis>
+ <synopsis>
+ kdf = tokenpos(str)
+ kdf = tokenpos(str, delimiter)
+ </synopsis>
</refsynopsisdiv>
<refsection>
<title>Parâmetros</title>
<!--
* Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
* Copyright (C) INRIA -
- *
* Copyright (C) 2012 - 2016 - Scilab Enterprises
+ * Copyright (C) 2020 - Samuel GOUGEON
*
* This file is hereby licensed under the terms of the GNU GPL v2.0,
* pursuant to article 5.3.4 of the CeCILL v.2.1.
* along with this program.
*
-->
-<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns4="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="tokens" xml:lang="pt">
+<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns4="http://www.w3.org/1999/xhtml"
+ xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org"
+ xml:id="tokens" xml:lang="pt">
<refnamediv>
<refname>tokens</refname>
- <refpurpose>retorna as fichas (tokens) de um string</refpurpose>
+ <refpurpose>
+ Divide um texto usando separadores e fornece seus pedaços
+ </refpurpose>
</refnamediv>
<refsynopsisdiv>
<title>Seqüência de Chamamento</title>
- <synopsis>T=tokens(str [,delimiter])</synopsis>
+ <synopsis>
+ Chunks = tokens(text)
+ Chunks = tokens(text, separators)
+ </synopsis>
</refsynopsisdiv>
<refsection>
<title>Parâmetros</title>
<variablelist>
<varlistentry>
- <term>str</term>
+ <term>text</term>
<listitem>
- <para>string, o local de procura dos tokens</para>
+ Um único texto a ser dividido. Pode incluir caracteres internacionais UTF-8
+ estendidos.
+ <para/>
</listitem>
</varlistentry>
<varlistentry>
- <term>delimiter</term>
+ <term>separators</term>
<listitem>
- <para>(opcional) um caractere ou um vetor de caracteres. Os
- delimitadores de fichas.
- </para>
+ Vetor de caracteres. Valor padrão = <literal>[" ",ascii(9)]</literal>,
+ ascii(9) sendo a tabulação horizontal.
+ <para/>
</listitem>
</varlistentry>
<varlistentry>
- <term>T</term>
+ <term>Chunks</term>
<listitem>
- <para>vetor coluna de fichas encontradas</para>
+ Vetor da coluna: partes do texto dividido.
+ <para/>
</listitem>
</varlistentry>
</variablelist>
<refsection>
<title>Descrição</title>
<para>
- <literal>T=tokens(str [,delimiter]) </literal> procura pelos tokens
- inclusos no string <literal>str</literal>. O padrão de
- <literal>delimiter</literal> é [" ",<Tab>] onde <Tab> é
- <literal>ascii(9)</literal>.
+ <literal>tokens(…)</literal> pesquisa no texto os separadores fornecidos,
+ e divide em pedaços. Os pedaços são sem separadores.
+ Separadores consecutivos são mesclados.
</para>
</refsection>
<refsection>
<title>Exemplos</title>
<programlisting role="example"><![CDATA[
-tokens('Isto é um string')
+tokens("The given text")
+
+tokens("SCI/demos/scicos", "/")'
-tokens('SCI/demos/scicos','/')
+tokens("Επιστήμη και καινοτομία", ["α"," "])'
-tokens('y=a+b*2',['=','+','*'])
+nbsp = ascii(160); // non-breakable space
+t = "the" + nbsp + "given text"
+tokens(t)
]]></programlisting>
+ <screen><![CDATA[
+--> tokens('The given text')
+ ans =
+ "The"
+ "given"
+ "text"
+
+
+--> tokens('SCI/demos/scicos', '/')'
+ ans =
+ "SCI" "demos" "scicos"
+
+
+--> tokens("Επιστήμη και καινοτομία", ["α"," "])'
+ ans =
+ "Επιστήμη" "κ" "ι" "κ" "ινοτομί"
+
+
+--> nbsp = ascii(160); // non-breakable space
+--> t = "the" + nbsp + "given text"
+ t =
+ "the given text"
+
+--> tokens(t)
+ ans =
+ "the given"
+ "text"
+]]></screen>
</refsection>
<refsection role="see also">
<title>Ver Também</title>
<simplelist type="inline">
<member>
+ <link linkend="strsplit">strsplit</link>
+ </member>
+ <member>
+ <link linkend="regexp">regexp</link>
+ </member>
+ <member>
<link linkend="strindex">strindex</link>
</member>
<member>
* along with this program.
*
-->
-<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:lang="ru" xml:id="convstr">
+<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns:svg="http://www.w3.org/2000/svg" xmlns:db="http://docbook.org/ns/docbook"
+ xmlns:scilab="http://www.scilab.org" xml:lang="ru" xml:id="convstr">
<refnamediv>
<refname>convstr</refname>
<refpurpose>преобразование регистра</refpurpose>
</refnamediv>
<refsynopsisdiv>
<title>Синтаксис</title>
- <synopsis>[y] = convstr(str, [flag])</synopsis>
+ <synopsis>
+ y = convstr(str)
+ y = convstr(str, flag)
+ </synopsis>
</refsynopsisdiv>
<refsection>
<title>Аргументы</title>
* along with this program.
*
-->
-<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" xmlns:scilab="http://www.scilab.org" xml:id="grep" xml:lang="ru">
+<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:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org"
+ xml:id="grep" xml:lang="ru">
<refnamediv>
<refname>grep</refname>
<refpurpose>поиск соответствий строки в векторе строк</refpurpose>
</refnamediv>
<refsynopsisdiv>
<title>Синтаксис</title>
- <synopsis>row = grep(haystack, needle )
+ <synopsis>
[row, which] = grep(haystack, needle )
- row = grep(haystack, needle, [flag])
- [row, which] = grep(haystack, needle, [flag])
+ [row, which] = grep(haystack, needle, "regexp" )
</synopsis>
</refsynopsisdiv>
<refsection>
</listitem>
</varlistentry>
<varlistentry>
- <term>flag</term>
+ <term>флаг "regexp" | "r"</term>
<listitem>
<para>
- символ (<literal>"r"</literal> для регулярного выражения).
+ одиночный символ: тогда элементы <varname>needle</varname> используются как
+ регулярные выражения.
</para>
</listitem>
</varlistentry>
регулярного выражения. В этом случае <function>grep</function>
использует <varname>needle</varname> в качестве регулярного
выражения и сравнивает его с <varname>haystack</varname> в
- соответствии с правилами регулярного выражения. См. подробности по регулярным выражениям в функции <link linkend="regexp">regexp</link>.
+ соответствии с правилами регулярного выражения. См. подробности по регулярным выражениям
+ в функции <link linkend="regexp">regexp</link>.
</para>
</refsection>
<refsection>
- <title>Пример №1</title>
+ <title>Примеры</title>
+ <para><emphasis role="bold">Пример № 1</emphasis></para>
<para>
В следующем примере мы ищем одну или две строки в тексте, который
хранится в переменной <varname>txt</varname>.
grep(txt,'строк')
grep(txt,['строк' 'Строк'])
[r,w]=grep(txt,['строк' 'Строк'])
- ]]></programlisting>
- </refsection>
- <refsection>
- <title>Пример №2</title>
+ ]]></programlisting>
+ <para/>
+
+ <para><emphasis role="bold">Пример № 2</emphasis></para>
<para>
В следующем примере выполняется поиск с помощью регулярных выражений.
</para>
<member>
<link linkend="regexp">regexp</link>
</member>
+ <member>
+ <link linkend="find">find</link>
+ </member>
+ <member>
+ <link linkend="vectorfind">vectorfind</link>
+ </member>
</simplelist>
</refsection>
</refentry>
<!--
* Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
* Copyright (C) INRIA -
- *
* Copyright (C) 2012 - 2016 - Scilab Enterprises
+ * Copyright (C) 2020 - Samuel GOUGEON
*
* This file is hereby licensed under the terms of the GNU GPL v2.0,
* pursuant to article 5.3.4 of the CeCILL v.2.1.
* along with this program.
*
-->
-<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:lang="ru" xml:id="isascii">
+<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns:svg="http://www.w3.org/2000/svg" xmlns:db="http://docbook.org/ns/docbook"
+ xmlns:scilab="http://www.scilab.org" xml:lang="ru" xml:id="isascii">
<refnamediv>
<refname>isascii</refname>
<refpurpose>
- проверяет - является ли символ 7-битным US-ASCII-символом
+ Проверяет - является ли каждый символ данной строки 7-битным US-ASCII
</refpurpose>
</refnamediv>
<refsynopsisdiv>
<refsection>
<title>Примеры</title>
<programlisting role="example"><![CDATA[
-letters = [115. 99. 105. 108. 97. 98.]
-isascii(letters)
-ascii(letters)
-isascii('scilab')
-isascii('Сайлаб')
- ]]></programlisting>
+isascii("Señor")
+
+nt = ascii("Señor")
+isascii(nt)
+
+t = "We know that γ² = 1/(1-β²)";
+isascii(t)
+part(t, find(~isascii(t)))
+ ]]></programlisting>
+ <screen><![CDATA[
+--> isascii("Señor")
+ ans =
+ T T F T T
+
+--> nt = ascii("Señor")
+ nt =
+ 83. 101. 195. 177. 111. 114.
+
+--> isascii(nt)
+ ans =
+ T T F F T T
+
+
+--> t = "We know that γ² = 1/(1-β²)";
+--> isascii(t)
+ ans =
+ T T T T T T T T T T T T T F F T T T T T T T T F F T
+
+--> part(t, find(~isascii(t)))
+ ans =
+ "γ²β²"
+]]></screen>
+ <para>
+ Табуляция, новые строки и т.д. являются специальными, но, в любом случае, US-ascii символами.
+ Неразрывные пробелы char(160) не являются US-ascii:
+ </para>
+ <programlisting role="example"><![CDATA[
+t = "a" + char(160) + "b" + ascii(9) + " EOL:" + ascii(10) + "Next"
+isascii(t)
+ascii(t)
+ ]]></programlisting>
+ <screen><![CDATA[
+--> t = "a" + char(160) + "b" + ascii(9) + " EOL:" + ascii(10) + "Next"
+ t =
+ "a b EOL:
+Next"
+
+--> isascii(t)
+ ans =
+ T F T T T T T T T T T T T T
+
+--> ascii(t)
+ ans =
+ 97. 194. 160. 98. 9. 32. 69. 79. 76. 58. 10. 78. 101. 120. 116.
+]]></screen>
</refsection>
<refsection role="see also">
<title>Смотрите также</title>
<simplelist type="inline">
<member>
+ <link linkend="ascii">ascii</link>
+ </member>
+ <member>
<link linkend="isalphanum">isalphanum</link>
</member>
+ <member>
+ <link linkend="isdigit">isdigit</link>
+ </member>
+ <member>
+ <link linkend="isletter">isletter</link>
+ </member>
+ <member>
+ <link linkend="isnum">isnum</link>
+ </member>
</simplelist>
</refsection>
</refentry>
* along with this program.
*
-->
-<refentry xmlns="http://docbook.org/ns/docbook"
- xmlns:xlink="http://www.w3.org/1999/xlink"
- xmlns:svg="http://www.w3.org/2000/svg"
- xmlns:mml="http://www.w3.org/1998/Math/MathML"
- xmlns:db="http://docbook.org/ns/docbook"
- xml:lang="ru" xml:id="justify">
+<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns:svg="http://www.w3.org/2000/svg" xmlns:mml="http://www.w3.org/1998/Math/MathML"
+ xmlns:db="http://docbook.org/ns/docbook" xml:lang="ru" xml:id="justify">
<refnamediv>
<refname>justify</refname>
- <refpurpose>выравнивание массива символов</refpurpose>
+ <refpurpose>
+ Выравнивает текст в столбцах по левому краю, центру или правому краю.
+ </refpurpose>
</refnamediv>
<refsynopsisdiv>
<title>Синтаксис</title>
- <synopsis>Tj = justify(T, opt)</synopsis>
+ <synopsis>Tj = justify(T, position)</synopsis>
</refsynopsisdiv>
<refsection>
<title>Аргументы</title>
</listitem>
</varlistentry>
<varlistentry>
- <term>opt</term>
+ <term>position</term>
<listitem>
<para>
- символьная опция с возможными значениями:
+ Возможные значения :
+ <table cellspacing="0" cellpadding="0">
+ <tr><td><term>'l' или 'left'</term></td><td>: для выравнивания по левому краю</td></tr>
+ <tr><td><term>'c' или 'center'</term></td><td>: для выравнивания по центру</td></tr>
+ <tr><td><term>'r' или 'right'</term></td><td>: для выравнивания по правому краю</td></tr>
+ </table>
</para>
- <variablelist>
- <varlistentry>
- <term>'r' или 'right'</term>
- <listitem>
- <para>для выравнивания по правому краю;</para>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term>'l' или 'left'</term>
- <listitem>
- <para>для выравнивания по левому краю;</para>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term>'c' или 'center'</term>
- <listitem>
- <para>для выравнивания по центру.</para>
- </listitem>
- </varlistentry>
- </variablelist>
</listitem>
</varlistentry>
</variablelist>
<refsection>
<title>Описание</title>
<para>
- Функция <function>justify</function> выравнивает столбцы матрицы строк в соответствии с заданной опцией <varname>opt</varname>.
+ Функция <function>justify</function> выравнивает столбцы матрицы строк в соответствии
+ с заданной значением <varname>position</varname>.
</para>
</refsection>
<refsection>
* along with this program.
*
-->
-<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="length" xml:lang="ru">
+<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:db="http://docbook.org/ns/docbook" xml:id="length" xml:lang="ru">
<refnamediv>
<refname>length</refname>
- <refpurpose>длина объекта</refpurpose>
+ <refpurpose>
+ Количество символов текста. Количество элементов массива или списка.
+ </refpurpose>
</refnamediv>
<refsynopsisdiv>
<title>Синтаксис</title>
* along with this program.
*
-->
-<refentry xmlns="http://docbook.org/ns/docbook"
-xmlns:xlink="http://www.w3.org/1999/xlink"
-xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns4="http://www.w3.org/1999/xhtml"
-xmlns:mml="http://www.w3.org/1998/Math/MathML"
-xmlns:db="http://docbook.org/ns/docbook"
-xml:id="regexp" xml:lang="ru">
+<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns4="http://www.w3.org/1999/xhtml"
+ xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook"
+ xml:id="regexp" xml:lang="ru">
<refnamediv>
<refname>regexp</refname>
<refpurpose>
<refsynopsisdiv>
<title>Синтаксис</title>
<synopsis>
- [start] = regexp(input, pattern, [flag])
- [start, end] = regexp(input, pattern, [flag])
- [start, end, match] = regexp(input, pattern, [flag])
- [start, end, match, foundString] = regexp(input, pattern, [flag])
+ [start, final, match, foundString] = regexp(input, pattern)
+ [start, final, match, foundString] = regexp(input, pattern, "once")
</synopsis>
</refsynopsisdiv>
<refsection>
</listitem>
</varlistentry>
<varlistentry>
- <term>[flag]</term>
+ <term>флаг "once | "o"</term>
<listitem>
<para>
- <literal>'o'</literal> для одного соответствия шаблону.
+ <literal>'o'</literal> только для одного совпадения с образцом.
</para>
</listitem>
</varlistentry>
* along with this program.
*
-->
-<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="strcat" xml:lang="ru">
+<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:db="http://docbook.org/ns/docbook" xml:id="strcat" xml:lang="ru">
<refnamediv>
<refname>strcat</refname>
<refpurpose>связывает символьные строки</refpurpose>
<refsynopsisdiv>
<title>Синтаксис</title>
<synopsis>
- txt = strcat(strings [,string_added])
- txt = strcat(strings [,string_added, ["flag"]])
+ txt = strcat(strings)
+ txt = strcat(strings, string_added)
+ txt = strcat(strings, string_added, "r")
+ txt = strcat(strings, string_added, "c")
</synopsis>
</refsynopsisdiv>
<refsection>
</listitem>
</varlistentry>
<varlistentry>
- <term>"flag"</term>
+ <term>флаг "r" | "c"</term>
<listitem>
<para>
символьное значение (<literal>"r"</literal> для связки строк в матрице <varname>strings</varname>,
<member>
<link linkend="strings">strings</link>
</member>
+ <member>
+ <link linkend="strsplit">strsplit</link>
+ </member>
+ <member>
+ <link linkend="brackets">квадратные скобки []</link>
+ </member>
</simplelist>
</refsection>
</refentry>
* along with this program.
*
-->
-<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns4="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="strcmp" xml:lang="ru">
+<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns4="http://www.w3.org/1999/xhtml"
+ xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org"
+ xml:id="strcmp" xml:lang="ru">
<refnamediv>
<refname>strcmp</refname>
<refpurpose>сравнение символьных строк</refpurpose>
</refnamediv>
<refsynopsisdiv>
<title>Синтаксис</title>
- <synopsis>res = strcmp(string_one, string_two, ['i'])</synopsis>
+ <synopsis>
+ res = strcmp(string_one, string_two)
+ res = strcmp(string_one, string_two, "i")
+ </synopsis>
</refsynopsisdiv>
<refsection>
<title>Аргументы</title>
интегральное значение, указывающее отношение между строками.
</para>
<para>
- Значение больше нуля указывает, что первый символ, который не соответствует, имеет большее значение в <varname>string_one</varname>, чем в <varname>string_two</varname>, а значение меньше нуля указывает обратное.
+ Значение больше нуля указывает, что первый символ, который не соответствует, имеет большее
+ значение в <varname>string_one</varname>, чем в <varname>string_two</varname>, а значение
+ меньше нуля указывает обратное.
</para>
<para>
Значение равное нулю указывает на то, что
* along with this program.
*
-->
-<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns4="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="strcspn" xml:lang="ru">
+<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns4="http://www.w3.org/1999/xhtml"
+ xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org"
+ xml:id="strcspn" xml:lang="ru">
<refnamediv>
<refname>strcspn</refname>
- <refpurpose>получение интервала до символа в строке</refpurpose>
+ <refpurpose>
+ длины текстов от начала до тех пор, пока не встретится запрещённый символ
+ </refpurpose>
</refnamediv>
<refsynopsisdiv>
<title>Синтаксис</title>
- <synopsis>res = strcspn(string_one, string_two)</synopsis>
+ <synopsis>
+ res = strcspn(string_one, string_two)
+ </synopsis>
</refsynopsisdiv>
<refsection>
<title>Аргументы</title>
* along with this program.
*
-->
-<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns4="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="strindex" xml:lang="ru">
+<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns4="http://www.w3.org/1999/xhtml"
+ xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org"
+ xml:id="strindex" xml:lang="ru">
<refnamediv>
<refname>strindex</refname>
<refpurpose>
<refsynopsisdiv>
<title>Синтаксис</title>
<synopsis>
- ind = strindex(haystack, needle, [flag])
- [ind, which] = strindex(haystack, needle, [flag])
+ [ind, which] = strindex(haystack, needle)
+ [ind, which] = strindex(haystack, needle, "regexp")
</synopsis>
</refsynopsisdiv>
<refsection>
</listitem>
</varlistentry>
<varlistentry>
- <term>flag</term>
+ <term>флаг "regexp" | "r"</term>
<listitem>
<para>
- строка (<literal>"r"</literal> для регулярного
- выражения).
+ Тогда элементы <varname>needle</varname> используются как регулярные выражения.
</para>
</listitem>
</varlistentry>
* along with this program.
*
-->
-<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:lang="ru" xml:id="strncpy">
+<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns:svg="http://www.w3.org/2000/svg" xmlns:db="http://docbook.org/ns/docbook"
+ xmlns:scilab="http://www.scilab.org" xml:lang="ru" xml:id="strncpy">
<refnamediv>
<refname>strncpy</refname>
- <refpurpose>копирование символов из строк</refpurpose>
+ <refpurpose>
+ Получает и указывает первые N символов в указанных текстах
+ </refpurpose>
</refnamediv>
<refsynopsisdiv>
<title>Синтаксис</title>
<!--
* Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
* Copyright (C) INRIA -
- *
* Copyright (C) 2012 - 2016 - Scilab Enterprises
+ * Copyright (C) 2020 - Samuel GOUGEON
*
* This file is hereby licensed under the terms of the GNU GPL v2.0,
* pursuant to article 5.3.4 of the CeCILL v.2.1.
* along with this program.
*
-->
-<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns4="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="strspn" xml:lang="ru">
+<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns4="http://www.w3.org/1999/xhtml"
+ xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org"
+ xml:id="strspn" xml:lang="ru">
<refnamediv>
<refname>strspn</refname>
- <refpurpose>получение интервала набора символов в строке</refpurpose>
+ <refpurpose>
+ длины текста от начала до тех пор, пока встечаются символы, которые разрешены
+ </refpurpose>
</refnamediv>
<refsynopsisdiv>
<title>Синтаксис</title>
- <synopsis>res = strspn(str1, str2)</synopsis>
+ <synopsis>headsLengths = strspn(Texts, allowedChars)</synopsis>
</refsynopsisdiv>
<refsection>
<title>Аргументы</title>
<variablelist>
<varlistentry>
- <term>str1</term>
- <listitem>
- <para>
- символьная строка или матрица символьных строк.
- </para>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term>str2</term>
+ <term>Texts, allowedChars, headsLengths</term>
<listitem>
<para>
- символьная строка или матрица символьных строк.
+ Матрицы текстов одинаковых размеров.
+ Разрешённые символы <varname>allowedChars</varname> могут быть в виде скалярной строки.
+ Тогда она используется для всех элементов текстов <varname>Texts</varname>.
</para>
</listitem>
</varlistentry>
- <varlistentry>
- <term>res</term>
- <listitem>
- <para>матрица символьных строк.</para>
- </listitem>
- </varlistentry>
</variablelist>
</refsection>
<refsection>
<title>Описание</title>
<para>
- <code>res = strspn(str1, str2)</code> возвращает длину начальной
- части <varname>str1</varname>, которая состоит только из символов,
- которые являются частью <varname>str2</varname>.
- </para>
- <para>
- <varname>str2</varname> должна иметь те же размеры, что и <varname>str1</varname>, либо <varname>str2</varname> должна быть строкой.
+ <literal>headsLengths = strspn(Texts, allowedChars)</literal> возвращает длину начальной
+ части <varname>Texts</varname>, которая состоит только из символов,
+ которые являются частью разрешённых символов <varname>allowedChars</varname>.
</para>
</refsection>
<refsection>
<title>Примеры</title>
<programlisting role="example"><![CDATA[
-i = strspn("129th","1234567890");
-mprintf ("Длина исходного номера: %d.\n",i);
-i = strspn(["129th","130th"],["1234567890","130t"])
+allowed = "0":"9"
+strspn("129th or the 130th", allowed)
+
+t = ["characters" "matrix" ; "text" "strings"]
+allowed = "a":"s"
+strspn(t, allowed)
+
+allowed = ["a":"j", "a":"u" ; "d":"u", "g":"v"]
+strspn(t, allowed)
+ ]]></programlisting>
+ <screen><![CDATA[
+--> allowed = "0":"9"
+ allowed =
+ "0123456789"
+
+--> strspn("129th or the 130th", allowed)
+ ans =
+ 3.
+
+
+--> t = ["characters" "matrix" ; "text" "strings"]
+ t =
+ "characters" "matrix"
+ "text" "strings"
+
+--> allowed = "a":"s"
+ allowed =
+ "abcdefghijklmnopqrs"
+--> strspn(t, allowed)
+ ans =
+ 6. 2.
+ 0. 1.
+
+--> allowed = ["a":"j", "a":"u" ; "d":"u", "g":"v"]
+ allowed =
+ "abcdefghij" "abcdefghijklmnopqrstu"
+ "defghijklmnopqrstu" "ghijklmnopqrstuv"
+
+--> strspn(t, allowed)
+ ans =
+ 3. 5.
+ 2. 7.
+]]></screen>
+ <para>
+ С символами, расширенными UTF-8:
+ </para>
+ <programlisting role="example"><![CDATA[
+t = "Να αμφιβάλλετε τα πάντα ή να μην αμφιβάλλετε τίποτα: " + ..
+ "δύο ίσοι τρόποι αποφυγής σκέψης.";
+t = matrix(strsplit(t," "), 2,-1)
+allowed = "Ναβγδεϵζηθικλμνξοπρστυφϕχψωϐϑϰϱςϖ";
+strspn(t, allowed)
]]></programlisting>
+ <screen><![CDATA[
+--> t = matrix(strsplit(t," "), 2,-1)
+ t =
+ "Να" "τα" "ή" "μην" "τίποτα:" "ίσοι" "αποφυγής"
+ "αμφιβάλλετε" "πάντα" "να" "αμφιβάλλετε" "δύο" "τρόποι" "σκέψης."
+
+--> allowed = "Ναβγδεϵζηθικλμνξοπρστυφϕχψωϐϑϰϱςϖ";
+--> strspn(t, allowed)
+ ans =
+ 2. 2. 0. 3. 1. 0. 6.
+ 5. 1. 2. 5. 1. 2. 2.
+]]></screen>
</refsection>
<refsection role="see also">
<title>Смотрите также</title>
<member>
<link linkend="strcspn">strcspn</link>
</member>
+ <member>
+ <link linkend="strncpy">strncpy</link>
+ </member>
+ <member>
+ <link linkend="part">part</link>
+ </member>
</simplelist>
</refsection>
</refentry>
* along with this program.
*
-->
-<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" xmlns:scilab="http://www.scilab.org" xml:id="strsubst" xml:lang="ru">
+<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:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org"
+ xml:id="strsubst" xml:lang="ru">
<refnamediv>
<refname>strsubst</refname>
<refpurpose>
<title>Синтаксис</title>
<synopsis>
string_out = strsubst(string_in, searchStr, replaceStr)
- string_out = strsubst(string_in, searchStr, replaceStr, [flag])
+ string_out = strsubst(string_in, searchStr, replaceStr, "regexp")
</synopsis>
</refsynopsisdiv>
<refsection>
<term>string_out</term>
<listitem>
<para>
- матрица символьных строк. Результат замены строки <varname>searchStr</varname> строкой
- <varname>replaceStr</varname> в <varname>string_in</varname>.
+ матрица символьных строк. Результат замены строки <varname>searchStr</varname>
+ строкой <varname>replaceStr</varname> в <varname>string_in</varname>.
</para>
</listitem>
</varlistentry>
<varlistentry>
- <term>flag</term>
+ <term>флаг "regexp" | "r"</term>
<listitem>
<para>
- символ (<literal>"r"</literal> для регулярного выражения).
+ Затем <varname>searchStr</varname> используется как регулярное выражение.
</para>
</listitem>
</varlistentry>
<para>
Когда используется четвёртый параметр <literal>"r"</literal>, то
строка <varname>searchStr</varname> должна быть регулярным
- выражением. Тогда <function>strsubst</function> будет будет
+ выражением. Тогда <function>strsubst</function> будет
сопоставлять её с <varname>string_in</varname> и заменять в
соответствии с правилами регулярных выражений.
</para>
<refsynopsisdiv>
<title>Синтаксис</title>
<synopsis>
- d = strtod(str [,decimalseparator])
- [d, tails] = strtod(str [,decimalseparator])
+ [d, tails] = strtod(str)
+ [d, tails] = strtod(str, decimalseparator)
</synopsis>
</refsynopsisdiv>
<refsection role="arguments">
* along with this program.
*
-->
-<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:lang="ru" xml:id="tokenpos">
+<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns:svg="http://www.w3.org/2000/svg" xmlns:db="http://docbook.org/ns/docbook"
+ xmlns:scilab="http://www.scilab.org" xml:lang="ru" xml:id="tokenpos">
<refnamediv>
<refname>tokenpos</refname>
<refpurpose>
</refnamediv>
<refsynopsisdiv>
<title>Синтаксис</title>
- <synopsis>kdf = tokenpos(str [,delimiter])</synopsis>
+ <synopsis>
+ kdf = tokenpos(str)
+ kdf = tokenpos(str, delimiter)
+ </synopsis>
</refsynopsisdiv>
<refsection>
<title>Аргументы</title>
<!--
* Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
* Copyright (C) INRIA -
- *
* Copyright (C) 2012 - 2016 - Scilab Enterprises
+ * Copyright (C) 2020 - Samuel GOUGEON
*
* This file is hereby licensed under the terms of the GNU GPL v2.0,
* pursuant to article 5.3.4 of the CeCILL v.2.1.
* along with this program.
*
-->
-<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:lang="ru" xml:id="tokens">
+<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns:svg="http://www.w3.org/2000/svg" xmlns:db="http://docbook.org/ns/docbook"
+ xmlns:scilab="http://www.scilab.org" xml:lang="ru" xml:id="tokens">
<refnamediv>
<refname>tokens</refname>
- <refpurpose>возвращает лексемы символьной строки</refpurpose>
+ <refpurpose>Делит текст, используя разделители и выдаёт его части.</refpurpose>
</refnamediv>
<refsynopsisdiv>
<title>Синтаксис</title>
- <synopsis>T = tokens(str [,delimiter])</synopsis>
+ <synopsis>
+ Chunks = tokens(text)
+ Chunks = tokens(text, separators)
+ </synopsis>
</refsynopsisdiv>
<refsection>
<title>Аргументы</title>
<variablelist>
<varlistentry>
- <term>str</term>
+ <term>text</term>
<listitem>
- <para>
- символьная строка. Строка в которой ищутся лексемы.
- </para>
+ Единый текст для разделения. Он может включать в себя расширенные международные символы UTF-8.
+ <para/>
</listitem>
</varlistentry>
<varlistentry>
- <term>delimiter</term>
+ <term>separators</term>
<listitem>
- <para>
- (необязательный) символ или вектор символов. Разделители лексем.
- </para>
+ Вектор символов. По умолчанию значение равно
+ <literal>[" ", ascii(9)]</literal>, ascii(9) - это горизонтальная табуляция.
+ <para/>
</listitem>
</varlistentry>
<varlistentry>
- <term>T</term>
+ <term>Chunks</term>
<listitem>
- <para>
- вектор-столбец найденных лексем.
- </para>
+ Вектор-столбец: части разделённого текста.
+ <para/>
</listitem>
</varlistentry>
</variablelist>
<refsection>
<title>Описание</title>
<para>
- <code>T = tokens(str [,delimiter])</code> ищет лексемы, содержащиеся
- в строке <varname>str</varname>. Значение разделителя
- <varname>delimiter</varname> по умолчанию <literal>[" ",<Tab>]</literal>,
- где <literal><Tab></literal> стоит вместо <code>ascii(9)</code>.
+ <literal>tokens(…)</literal> ищет текст для указанных разделителей и делит его на части.
+ Части свободны от разделителей. Последовательные разделители объединены.
</para>
</refsection>
<refsection>
<title>Примеры</title>
<programlisting role="example"><![CDATA[
-tokens('Это символьная строка.')
-tokens('SCI/demos/scicos','/')
-tokens('y=a+b*2',['=','+','*'])
+tokens("The given text")
+
+tokens("SCI/demos/scicos", "/")'
+
+tokens("Επιστήμη και καινοτομία", ["α"," "])'
+
+nbsp = ascii(160); // неразрывный пробел
+t = "the" + nbsp + "given text"
+tokens(t)
]]></programlisting>
+ <screen><![CDATA[
+--> tokens('The given text')
+ ans =
+ "The"
+ "given"
+ "text"
+
+
+--> tokens('SCI/demos/scicos', '/')'
+ ans =
+ "SCI" "demos" "scicos"
+
+
+--> tokens("Επιστήμη και καινοτομία", ["α"," "])'
+ ans =
+ "Επιστήμη" "κ" "ι" "κ" "ινοτομί"
+
+
+--> nbsp = ascii(160); // неразрывный пробел
+--> t = "the" + nbsp + "given text"
+ t =
+ "the given text"
+
+--> tokens(t)
+ ans =
+ "the given"
+ "text"
+]]></screen>
</refsection>
<refsection role="see also">
<title>Смотрите также</title>
<simplelist type="inline">
<member>
+ <link linkend="strsplit">strsplit</link>
+ </member>
+ <member>
+ <link linkend="regexp">regexp</link>
+ </member>
+ <member>
<link linkend="strindex">strindex</link>
</member>
<member>