(array) tokenize ($haystack, [$delimiter = '_', [$rawFirst = false]])
camelCase や StudlyCaps 、 snake_case などの複合語を、トークンに分割します。
Parameters:
name | type | default | caption |
---|---|---|---|
$haystack | string | String to Convert. | |
$delimiter | string | '_' | Delimiter. |
$rawFirst | boolean | false | Keep 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']