svn: /phpdoc/zh/trunk/reference/mbstring/functions/ mb-strcut.xml mb-substr.xml

From: Date: Thu, 19 Jan 2017 15:56:17 +0000
Subject: svn: /phpdoc/zh/trunk/reference/mbstring/functions/ mb-strcut.xml mb-substr.xml
Groups: php.doc.zh 
Request: Send a blank email to doc-zh+get-4767@lists.php.net to get a copy of this message
daijie Thu, 19 Jan 2017 15:56:17 +0000 Revision: http://svn.php.net/viewvc?view=revision&revision=341702 Log: Sync with EN Changed paths: U phpdoc/zh/trunk/reference/mbstring/functions/mb-strcut.xml U phpdoc/zh/trunk/reference/mbstring/functions/mb-substr.xml Modified: phpdoc/zh/trunk/reference/mbstring/functions/mb-strcut.xml =================================================================== --- phpdoc/zh/trunk/reference/mbstring/functions/mb-strcut.xml 2017-01-19 15:37:53 UTC (rev 341701) +++ phpdoc/zh/trunk/reference/mbstring/functions/mb-strcut.xml 2017-01-19 15:56:17 UTC (rev 341702) @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="utf-8"?> <!-- $Revision$ --> -<!-- EN-Revision: 331340 Maintainer: daijie Status: ready --> +<!-- EN-Revision: 340219 Maintainer: daijie Status: ready --> <!-- Reviewed: no --> <refentry xml:id="function.mb-strcut" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"> @@ -19,7 +19,7 @@ <methodparam choice="opt"><type>string</type><parameter>encoding</parameter><initializer>mb_internal_encoding()</initializer></methodparam> </methodsynopsis> <para> - <function>mb_strcut</function> 和 <function>mb_substr</function> 类似,都是从一个字符串中提取子字符串,但是按字节数来执行,而不是字符个数。 + <function>mb_strcut</function> 和 <function>mb_substr</function> 类似,都是从字符串中提取子字符串,但是按字节数来执行,而不是字符个数。 如果截断位置位于多字节字符两个字节的中间,将于该字符的第一个字节开始执行。 这也是和 <function>substr</function> 函数的不同之处,后者简单地将字符串在字节之间截断,这将导致一个畸形的字节序列。 </para> @@ -41,8 +41,12 @@ <term><parameter>start</parameter></term> <listitem> <para> - 起始位置,以<emphasis>字节</emphasis>为单位。 + 如果 <parameter>start</parameter> 不是负数,返回的字符串会从 <parameter>str</parameter> 的第 <parameter>start</parameter> <emphasis>字节</emphasis>位置开始,从 0 开始计数。举个例子,字符串 '<literal>abcdef</literal>',字节位置 <literal>0</literal> 的字符是 '<literal>a</literal>',字节位置 <literal>2</literal> 的字符是 + '<literal>c</literal>',以此类推。 </para> + <para> + 如果 <parameter>start</parameter> 是负数,返回的字符串是从 <parameter>str</parameter> 末尾处第 <parameter>start</parameter> 个字节开始的。 + </para> </listitem> </varlistentry> <varlistentry> @@ -70,6 +74,33 @@ <function>mb_strcut</function> 根据 <parameter>start</parameter> 和 <parameter>length</parameter> 参数返回 <parameter>str</parameter> 的一部分。 </para> </refsect1> + + + <refsect1 role="changelog"> + &reftitle.changelog; + <para> + <informaltable> + <tgroup cols="2"> + <thead> + <row> + <entry>&Version;</entry> + <entry>&Description;</entry> + </row> + </thead> + <tbody> + <row> + <entry>5.4.8</entry> + <entry> + Passing <literal>NULL</literal> as <parameter>length</parameter> + extracts all bytes to the end of the string. Prior to this version + <literal>NULL</literal> was treated the same as <literal>0</literal>. + </entry> + </row> + </tbody> + </tgroup> + </informaltable> + </para> + </refsect1> <refsect1 role="seealso"> &reftitle.seealso; Modified: phpdoc/zh/trunk/reference/mbstring/functions/mb-substr.xml =================================================================== --- phpdoc/zh/trunk/reference/mbstring/functions/mb-substr.xml 2017-01-19 15:37:53 UTC (rev 341701) +++ phpdoc/zh/trunk/reference/mbstring/functions/mb-substr.xml 2017-01-19 15:56:17 UTC (rev 341702) @@ -1,12 +1,12 @@ <?xml version="1.0" encoding="utf-8"?> <!-- $Revision$ --> -<!-- EN-Revision: 331340 Maintainer: daijie Status: ready --> +<!-- EN-Revision: 340219 Maintainer: daijie Status: ready --> <!-- Reviewed: no --> <refentry xml:id="function.mb-substr" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"> <refnamediv> <refname>mb_substr</refname> - <refpurpose>获取字符串的部分</refpurpose> + <refpurpose>获取部分字符串</refpurpose> </refnamediv> <refsect1 role="description"> @@ -41,18 +41,19 @@ <term><parameter>start</parameter></term> <listitem> <para> - <parameter>str</parameter> 中要使用的第一个字符的位置。 + 如果 <parameter>start</parameter> 不是负数,返回的字符串会从 <parameter>str</parameter> 第 <parameter>start</parameter> 的位置开始,从 0 开始计数。举个例子,字符串 '<literal>abcdef</literal>',位置 <literal>0</literal> 的字符是 '<literal>a</literal>',位置 <literal>2</literal> 的字符是 + '<literal>c</literal>',以此类推。 </para> + <para> + 如果 <parameter>start</parameter> 是负数,返回的字符串是从 <parameter>str</parameter> 末尾处第 <parameter>start</parameter> 个字符开始的。 + </para> </listitem> </varlistentry> <varlistentry> <term><parameter>length</parameter></term> <listitem> <para> - <parameter>str</parameter> 中要使用的最大字符数。 - If - omitted or <literal>NULL</literal> is passed, extract all characters to - the end of the string. + <parameter>str</parameter> 中要使用的最大字符数。如果省略了此参数或者传入了 <literal>NULL</literal>,则会提取到字符串的尾部。 </para> </listitem> </varlistentry> @@ -72,6 +73,32 @@ <function>mb_substr</function> 函数根据 <parameter>start</parameter> 和 <parameter>length</parameter> 参数返回 <parameter>str</parameter> 中指定的部分。 </para> </refsect1> + + <refsect1 role="changelog"> + &reftitle.changelog; + <para> + <informaltable> + <tgroup cols="2"> + <thead> + <row> + <entry>&Version;</entry> + <entry>&Description;</entry> + </row> + </thead> + <tbody> + <row> + <entry>5.4.8</entry> + <entry> + <parameter>length</parameter> 传入 <literal>NULL</literal>,则从 start 提取到字符串的结尾处。 + 在之前的版本里, + <literal>NULL</literal> 会被当作 <literal>0</literal> 来处理。 + </entry> + </row> + </tbody> + </tgroup> + </informaltable> + </para> + </refsect1> <refsect1 role="seealso"> &reftitle.seealso;

« previous php.doc.zh (#4767) next »