Stringy\Stringy::toLowerCase PHP Méthode

toLowerCase() public méthode

Converts all characters in the string to lowercase. An alias for PHP's mb_strtolower().
public toLowerCase ( ) : Stringy
Résultat Stringy Object with all characters of $str being lowercase
    public function toLowerCase()
    {
        $str = \mb_strtolower($this->str, $this->encoding);
        return static::create($str, $this->encoding);
    }

Usage Example

Exemple #1
1
 /**
  * Returns a trimmed string with the first letter of each word capitalized.
  * Also accepts an array, $ignore, allowing you to list words not to be
  * capitalized.
  *
  * @param  array   $ignore An array of words not to capitalize
  * @return Stringy Object with a titleized $str
  */
 public function titleize($ignore = null)
 {
     $stringy = static::create($this->trim(), $this->encoding);
     $encoding = $this->encoding;
     $stringy->str = preg_replace_callback('/([\\S]+)/u', function ($match) use($encoding, $ignore) {
         if ($ignore && in_array($match[0], $ignore)) {
             return $match[0];
         } else {
             $stringy = new Stringy($match[0], $encoding);
             return (string) $stringy->toLowerCase()->upperCaseFirst();
         }
     }, $stringy->str);
     return $stringy;
 }