HH\Lib\Str\split

This API is part of the Hack Standard Library, not HHVM itself.
Facebook Engineer?

This function is available as Str\split() in Facebook's www repository.

Returns a vec containing the string split on the given delimiter

Description

namespace HH\Lib\Str;

function split(
  string $string,
  string $delimiter,
  ?int $limit = null,
): vec<string>;

The vec will not contain the delimiter itself.

If the limit is provided, the vec will only contain that many elements, where the last element is the remainder of the string.

To split the string into equally-sized chunks, see Str\chunk().

Previously known as explode in PHP.

Parameters

  • string $string
  • string $delimiter
  • ?int $limit = null