Esempio n. 1
0
File: String.php Progetto: phpj/phpj
 /**
  * Copies characters from this string into the destination character
  * array.
  * <p>
  * The first character to be copied is at index {@code srcBegin};
  * the last character to be copied is at index {@code srcEnd-1}
  * (thus the total number of characters to be copied is
  * {@code srcEnd-srcBegin}). The characters are copied into the
  * subarray of {@code dst} starting at index {@code dstBegin}
  * and ending at index:
  * <blockquote><pre>
  *     dstbegin + (srcEnd-srcBegin) - 1
  * </pre></blockquote>
  *
  * @param      int $srcBegin
  *             index of the first character in the string to copy.
  * @param      int $srcEnd
  *             index after the last character in the string to copy.
  * @param      string $dst
  *             the destination array.
  * @param      int $dstBegin
  *             the start offset in the destination array.
  * @exception StringOutOfBoundsException If any of the following
  *            is true:
  *            <ul><li>{@code srcBegin} is negative.
  *            <li>{@code srcBegin} is greater than {@code srcEnd}
  *            <li>{@code srcEnd} is greater than the length of this
  *                string
  *            <li>{@code dstBegin} is negative
  *            <li>{@code dstBegin+(srcEnd-srcBegin)} is larger than
  *                {@code dst.length}</ul>
  * @return CharArray
  */
 public function getCharsFromTo($srcBegin, $srcEnd, &$dst, $dstBegin)
 {
     $this->validateCharsArguments($srcBegin, $srcEnd, $dst, $dstBegin);
     $dst = $dst instanceof CharArray ? $dst : CharArray::fromString((string) $dst);
     System::arraycopyNoCheck($this->toCharArray(), $srcBegin, $dst, $dstBegin, $srcEnd - $srcBegin);
     return $dst;
 }