The Cusp of Helix

Intact Case リファレンス
[tokenize]

(array) tokenize ($haystack, [$delimiter = '_', [$rawFirst = false]])

camelCase や StudlyCaps 、 snake_case などの複合語を、トークンに分割します。

Parameters:

nametypedefaultcaption
$haystackstringString to Convert.
$delimiterstring'_'Delimiter.
$rawFirstbooleanfalseKeep raw first word in tokens for camelCase.

Returns:

  • (array) — tokens.

Author:

  • StewEucen

Since:

  • Version 1.0.0

Examples:

use StewEucen\Acts\IntactCase IntactCase::tokenize('highClass') //=> ['High', 'Class'] IntactCase::tokenize('highClass', '_', true) //=> ['high', 'Class'] IntactCase::tokenize('StudlyCaps') //=> ['Studly', 'Caps'] IntactCase::tokenize('snake_case') //=> ['snake', 'case'] IntactCase::tokenize('get_utc__day') //=> ['get', 'utc_', 'day']