public function filter($value) { if (!is_string($this->_replaceSeparator)) { throw new \Exception('"' . $this->_replaceSeparator . '" is not a valid replaceSeparator.'); } $result = str_replace(parent::getSeparator(), $this->_replaceSeparator, $value); return $result; }
/** * settin' the regex gubbins, Cap'n! */ public function __construct($separator) { parent::__construct($separator); // garr! backslash any regex letters an' symbols $quote = preg_quote($this->separator, '#'); // create some feckin' voodoo black magic regex $this->patterns = array('#(' . $quote . ')([A-Za-z]{1})#', '#(^[A-Za-z]{1})#'); }
public function filter($value) { $word = array(); $word = preg_split('/(?<=[a-z])(?=[A-Z])/x', $value); $count = count($word); for ($i = 0; $i < $count; ++$i) { $word[$i]; } $result = implode(parent::getSeparator(), $word); return $result; }
/** * Defined by Zend\Filter\Filter * * @param string $value * @return string */ public function filter($value) { if (self::hasPcreUnicodeSupport()) { parent::setPattern(array('#(?<=(?:\\p{Lu}))(\\p{Lu}\\p{Ll})#', '#(?<=(?:\\p{Ll}|\\p{Nd}))(\\p{Lu})#')); parent::setReplacement(array($this->separator . '\\1', $this->separator . '\\1')); } else { parent::setPattern(array('#(?<=(?:[A-Z]))([A-Z]+)([A-Z][A-z])#', '#(?<=(?:[a-z0-9]))([A-Z])#')); parent::setReplacement(array('\\1' . $this->separator . '\\2', $this->separator . '\\1')); } return parent::filter($value); }
public function filter($value) { $word = array(); $word = explode(parent::getSeparator(), $value); $count = count($word); for ($i = 0; $i < $count; ++$i) { $word[$i] = ucfirst($word[$i]); } $result = implode('', $word); return $result; }
/** * Defined by Zend\Filter\Filter * * @param string $value * @return string */ public function filter($value) { if (self::isUnicodeSupportEnabled()) { parent::setMatchPattern(array('#(?<=(?:\p{Lu}))(\p{Lu}\p{Ll})#','#(?<=(?:\p{Ll}|\p{Nd}))(\p{Lu})#')); parent::setReplacement(array($this->_separator . '\1', $this->_separator . '\1')); } else { parent::setMatchPattern(array('#(?<=(?:[A-Z]))([A-Z]+)([A-Z][A-z])#', '#(?<=(?:[a-z0-9]))([A-Z])#')); parent::setReplacement(array('\1' . $this->_separator . '\2', $this->_separator . '\1')); } return parent::filter($value); }
/** * Defined by Zend\Filter\Filter * * @param string $value * @return string */ public function filter($value) { // a unicode safe way of converting characters to \x00\x00 notation $pregQuotedSeparator = preg_quote($this->_separator, '#'); if (self::isUnicodeSupportEnabled()) { parent::setMatchPattern(array('#(' . $pregQuotedSeparator . ')(\\p{L}{1})#e', '#(^\\p{Ll}{1})#e')); parent::setReplacement(array("strtoupper('\\2')", "strtoupper('\\1')")); } else { parent::setMatchPattern(array('#(' . $pregQuotedSeparator . ')([A-Za-z]{1})#e', '#(^[A-Za-z]{1})#e')); parent::setReplacement(array("strtoupper('\\2')", "strtoupper('\\1')")); } return parent::filter($value); }
/** * Defined by Zend\Filter\Filter * * @param string $value * @return string */ public function filter($value) { // a unicode safe way of converting characters to \x00\x00 notation $pregQuotedSeparator = preg_quote($this->separator, '#'); if (self::hasPcreUnicodeSupport()) { parent::setPattern(array('#(' . $pregQuotedSeparator . ')(\\p{L}{1})#eu', '#(^\\p{Ll}{1})#eu')); if (!extension_loaded('mbstring')) { parent::setReplacement(array("strtoupper('\\2')", "strtoupper('\\1')")); } else { parent::setReplacement(array("mb_strtoupper('\\2', 'UTF-8')", "mb_strtoupper('\\1', 'UTF-8')")); } } else { parent::setPattern(array('#(' . $pregQuotedSeparator . ')([A-Za-z]{1})#e', '#(^[A-Za-z]{1})#e')); parent::setReplacement(array("strtoupper('\\2')", "strtoupper('\\1')")); } return parent::filter($value); }
/** * Defined by Zend\Filter\Filter * * @param string $value * @return string */ public function filter($value) { $this->setPattern('#-#'); $this->setReplacement($this->separator); return parent::filter($value); }