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

[email protected] (Yoshinari Takaoka)
Newsgroups php.doc.ja
Message-ID <[email protected]>
mumumu                                   Sun, 12 Jul 2020 22:26:40 +0000

Revision: http://svn.php.net/viewvc?view=revision&revision=350146

Log:
Fully document behavior of negative arguments to mb_strcut

When reading the source code, I noticed there is some special handling of
negative 'start' and 'length' arguments which is not mentioned in the
manual.

Patch contributed by Alex Dowad.

Changed paths:
    U   phpdoc/ja/trunk/reference/mbstring/functions/mb-strcut.xml

Modified: phpdoc/ja/trunk/reference/mbstring/functions/mb-strcut.xml
===================================================================
--- phpdoc/ja/trunk/reference/mbstring/functions/mb-strcut.xml	2020-07-12 14:43:53 UTC (rev 350145)
+++ phpdoc/ja/trunk/reference/mbstring/functions/mb-strcut.xml	2020-07-12 22:26:40 UTC (rev 350146)
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="utf-8"?>
 <!-- $Revision$ -->
-<!-- EN-Revision: 340219 Maintainer: hirokawa Status: ready -->
-<!-- CREDITS: takagi -->
+<!-- EN-Revision: 350143 Maintainer: hirokawa Status: ready -->
+<!-- CREDITS: takagi,mumumu -->
 <refentry xml:id="function.mb-strcut" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
  <refnamediv>
   <refname>mb_strcut</refname>
@@ -53,8 +53,10 @@
        <literal>2</literal> バイト目は '<literal>c</literal>' のようになります。
       </para>
       <para>
-       <parameter>start</parameter> が負の数の場合に返される文字列は、
-       <parameter>str</parameter> の後ろから数えて <parameter>start</parameter> バイト目以降となります。
+       <parameter>start</parameter> が負の場合に返される文字列は、
+       <parameter>str</parameter> の後ろから数えて <parameter>start</parameter> バイト目以降となります。
+       負の <parameter>start</parameter> の値が文字列の長さよりも大きい場合、
+       返される文字列は、<parameter>str</parameter> の先頭から始まります。
       </para>
      </listitem>
     </varlistentry>
@@ -66,6 +68,13 @@
        省略したり <literal>NULL</literal> を指定したりした場合は、
        文字列の最後までの全バイトを取り出します。
       </para>
+      <para>
+       <parameter>length</parameter> が負の場合、返される文字列は
+       <parameter>str</parameter> の後ろから数えて
+       <parameter>length</parameter> バイト目で終了します。
+       しかし、負の <parameter>length</parameter> の大きさが
+       <parameter>start</parameter> の位置を超える場合、空の文字列が返されます。
+      </para>
      </listitem>
     </varlistentry>
     <varlistentry>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.