HH\Lib\Str\slice_l

Meta Engineer?

This is available as Str\slice_l in the www repository.

Returns a substring of length $length of the given string starting at the $offset

namespace HH\Lib\Str;

function slice_l(
  \HH\Lib\Locale\Locale $locale,
  string $string,
  int $offset,
  ?int $length = NULL,
): string;

$offset and $length are specified as a number of characters.

If no length is given, the slice will contain the rest of the string. If the length is zero, the empty string will be returned. If the offset is out-of-bounds, an InvalidArgumentException will be thrown.

See slice() for a byte-based operation.

Guide

Parameters

  • \HH\Lib\Locale\Locale $locale
  • string $string
  • int $offset
  • ?int $length = NULL

Returns

  • string