title | tags |
---|---|
decapitalize
|
string,beginner
|
Decapitalizes the first Letter of a string.
- Decapitalizes the first letter of the string and then adds it with rest of the string.
- Omit the
$upperRest
parameter to keep the rest of the string intact, or set it totrue
to convert to uppercase.
function decapitalize($string, $upperRest = false) { return lcfirst($upperRest ? strtoupper($string) : $string); } decapitalize('FooBar'); // 'fooBar'
CC0-1.0 license
The post Decapitalizes the first letter of the string PHP method first appeared on CodeSnippetsandTutorials™ - Code Tutorials, Graphic Design and More.