Beispiel #1
0
 public function testDSuccess()
 {
     $data = array(array('in' => 'Иванов иван иванович', 'out' => 'иванов иван иванович'));
     foreach ($data as $num => $item) {
         $this->assertEquals($item['out'], mb_lcfirst($item['in']), 'Test #' . ($num + 1));
     }
 }
function mb_tag_search_string($content, $subject, $pretag, $posttag, $strict)
{
    //if $strict = true only string with same upper/lowercase as subject will get tagged
    if ($strict === true) {
        $replace_string = $pretag . $subject . $posttag;
        $content = str_replace($subject, $replace_string, $content);
    } else {
        //first lowercase (must be first if pretag or posttag contains small letters otherwise pretag and posttag will also get highlighted)
        $subject = mb_lcfirst($subject);
        $replace_string = $pretag . $subject . $posttag;
        $content = str_replace($subject, $replace_string, $content);
        //then uppercase
        $subject = ucfirst($subject);
        $replace_string = $pretag . $subject . $posttag;
        $content = str_replace($subject, $replace_string, $content);
    }
    return $content;
}
Beispiel #3
0
 /**
  * Get the string with the first character in lower-case.
  *
  * @return Rope
  */
 public function lowerFirst()
 {
     return static::of(mb_lcfirst($this->contents, $this->encoding), $this->encoding);
 }
Beispiel #4
0
 /**
  * Camelize the word - Also convert DIRECTORY_SEPARATOR to NAMESPACE_SEPARATOR to convert namespaces
  *
  * @param string $word
  * @param boolean $lcfirst
  * @return string
  */
 public static function camelize($word, $lcfirst = false)
 {
     $word = str_replace(DIRECTORY_SEPARATOR, NAMESPACE_SEPARATOR, $word);
     $word = preg_replace('/^.|[\\\\_]./e', "mb_strtoupper( '\\0' )", $word);
     $word = str_replace('_', '', $word);
     if ($lcfirst) {
         $word = mb_lcfirst($word);
     }
     return $word;
 }