ZF-9280: Capitalize String
Description
For last name, we can use StringToUpper, for first name, i want that the first letter of the string to be Upper and others to be lower, so there is some code :
<?php /* * Filtre permettant d'avoir une chaine de caractère dont * la première lettre est en majuscule et les autres en minuscules. */ class Zend_Filter_StringToCapitalize implements Zend_Filter_Interface { protected $_encoding = null; public function setEncoding($encoding = null){ if (!function_exists('mb_strtolower')) { require_once 'Zend/Filter/Exception.php'; throw new Zend_Filter_Exception('mbstring is required for this feature'); } $this->_encoding = $encoding; } public function filter($value){ if ($this->_encoding) { return ucfirst(mb_strtolower((string) $value, $this->_encoding)); } return ucfirst(strtolower((string) $value)); } } ?>
Comments
Posted by Sébastien CHAZALLET (sch) on 2010-02-27T03:01:43.000+0000
Source file
Posted by Thomas Weidner (thomas) on 2010-04-12T13:06:26.000+0000
Or simpler:
Posted by Thomas Weidner (thomas) on 2010-04-12T13:48:10.000+0000
Closing as needs proposal. Waiting for acceptance from dev team.