Call to undefined method Kirby\Toolkit\Str::lcfirst()

,

Hi there,

Could someone explain to me why Str::ucfirst() works and not Str::lcfirst?

I’ve got this error when I try to use it : “Call to undefined method Kirby\Toolkit\Str::lcfirst()”.

Is there a way to do this in Kirby?

Thank you all !

Because a method with that name doesn’t exist. Str::camel() implements lcfirst().

Edit: actually, that is not quite right, I think it Str::camel() turns the first letter into lowercase, and then replaces underscores with uppercase first letters, to convert for example My_stupid_method to 'myStupidMethod`.

So there doesn’t seem to be a simple replacement for lcfirst()

1 Like

Thank you texnixe.
With Str::camel() I get a capital letter on the next word. But it works simply by using lcfirst() !

<?= lcfirst($sentence) ?>

Thank you :smiley:

Just wanted to point out to anyone reading this that Kirby does have a lot of neat things for doing stuff with strings, dates, arrays etc which you can find here in Toolkit

2 Likes