HH\Lib\Str\split_l

Facebook Engineer?

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

Returns a vec containing the string split on the given delimiter

namespace HH\Lib\Str;

function split_l(
  \HH\Lib\Locale\Locale $locale,
  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_l(). To use a pattern as delimiter, see Regex\split().

Guide

Parameters

  • \HH\Lib\Locale\Locale $locale
  • string $string
  • string $delimiter
  • ?int $limit = NULL

Returns

  • vec<string>