HH\Lib\Str\chunk

Requires the Hack Standard Library to be installed.
Facebook Engineer?

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

Returns a vec containing the string split into chunks of the given size

namespace HH\Lib\Str;

function chunk(
  string $string,
  int $chunk_size = 1,
): vec<string>;

To split the string on a delimiter, see Str\split().

Parameters

  • string $string
  • int $chunk_size = 1

Returns

  • vec<string>