Question

I'd like to know if it's possible to use CakePHP's function to rewrite strings.

For example, the FormHelper does exactly what I need: "this_stuff" becomes "This Stuff" for the input's labels.

I guess there's a method for this, but I couldn't find anything.

Thanks in advance.

Solution Inflector::humanize($underscored)

    Input: apple_pie, some_thing, people_person
    Output: Apple Pie, Some Thing, People Person
Was it helpful?

Solution

You can use Inflector:

static **Inflector::camelize($underscored)**
Input: Apple_pie, some_thing, people_person
Output: ApplePie, SomeThing, PeoplePerson

http://book.cakephp.org/2.0/en/core-utility-libraries/inflector.html

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top