HH\Lib\Str\length_l

Facebook Engineer?

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

Returns the length of the given string in characters

namespace HH\Lib\Str;

function length_l(
  \HH\Lib\Locale\Locale $locale,
  string $string,
): int;

This function may be O(1) or O(n) depending on the encoding specified by the locale (LC_CTYPE).

See Str\length() (or pass Locale\c()) for the length in bytes.

Guide

Parameters

  • \HH\Lib\Locale\Locale $locale
  • string $string

Returns

  • int