TypeRocket v1 Pro users can now upgrade to TypeRocket v5 at their convenience.
Strings
( v1 )
String
The functions of the Str
class are all UTF8 enabled and can work with Unicode characters.
Starts
Use the method starts()
to test if a string starts with a value.
$needle = 'Name';
$subject = 'Names are cool.';
$bool = \TypeRocket\Utility\Str::starts( $needle, $subject );
Ends
Use the method ends()
to test if a string ends with a value.
$needle = 'ol.';
$subject = 'Names are cool.';
$bool = \TypeRocket\Utility\Str::ends( $needle, $subject );
Contains
Use the method contains()
to test if a string contains a value.
$needle = 'are';
$subject = 'Names are cool.';
$bool = \TypeRocket\Utility\Str::contains( $needle, $subject );
Camelize
Use the method camelize()
to camel case a string.
$name = 'hi_there';
$capitalize_first_char = true;
$bool = \TypeRocket\Utility\Str::camelize($name, '_', $capitalize_first_char);
Trim Start
Use the method trimStart()
to trim the start of a string.
$name = 'hi_there';
$bool = \TypeRocket\Utility\Str::trimStart($name, 'hi_');
Camelize
Use the method camelize()
to test if a string contains a value.
$name = 'hi_there';
$capitalize_first_char = true;
$bool = \TypeRocket\Utility\Str::camelize($name, '_', $capitalize_first_char);
Found a typo? Something is wrong in this documentation? Fork and edit it!