JonathanTorres\Construct\Helpers\Str::toStudly PHP Method

toStudly() public method

Convert string to studly case.
public toStudly ( string $string ) : string
$string string
return string
    public function toStudly($string)
    {
        $value = ucwords(str_replace(['-', '_'], ' ', $string));
        return str_replace(' ', '', $value);
    }

Usage Example

Example #1
0
 /**
  * Save versions of project names.
  *
  * @return void
  */
 protected function saveNames()
 {
     $names = $this->str->split($this->settings->getProjectName());
     $this->vendorLower = $this->str->toLower($names['vendor']);
     $this->vendorUpper = $this->str->toStudly($names['vendor']);
     $this->projectLower = $this->str->toLower($names['project']);
     $this->projectUpper = $this->str->toStudly($names['project']);
 }