cleanString() 공개 정적인 메소드

Clean a string to make it valid as PHP variable See more about the used regular expression at {@link http://www.regular-expressions.info/unicode.html}: - \p{L} for any valid letter - \p{N} for any valid number - /u for suporting unicode
public static cleanString ( string $string, boolean $keepMultipleUnderscores = true ) : string
$string string the string to clean
$keepMultipleUnderscores boolean optional, allows to keep the multiple consecutive underscores
리턴 string
예제 #1
0
 /**
  * Clean a string to make it valid as PHP variable
  * @uses GeneratorUtils::cleanString()
  * @param string $string the string to clean
  * @param bool $keepMultipleUnderscores optional, allows to keep the multiple consecutive underscores
  * @return string
  */
 public static function cleanString($string, $keepMultipleUnderscores = true)
 {
     return GeneratorUtils::cleanString($string, $keepMultipleUnderscores);
 }
예제 #2
0
 /**
  *
  */
 public function testCleanString()
 {
     $this->assertSame('КонтактнаяИнформация', Utils::cleanString('КонтактнаяИнформация'));
     $this->assertSame('____________________', Utils::cleanString('-"\'{&~(|`\\^¨@)°]+=}£'));
     $this->assertSame('1234567890aBcD_EfGhI', Utils::cleanString('1234567890aBcD_EfGhI'));
     $this->assertSame('äöüß', Utils::cleanString('äöüß'));
     $this->assertSame('θωερτψυιοπασδφγηςκλζχξωβνμάέήίϊΐόύϋΰώ', 'θωερτψυιοπασδφγηςκλζχξωβνμάέήίϊΐόύϋΰώ');
 }