truncate() 공개 정적인 메소드

Truncates a string.
public static truncate ( string $value, array $format = [] ) : string
$value string Value
$format array Default format is `array('length' => 80, 'etc' => '...', 'break_words' => false)`
리턴 string
예제 #1
0
 public function testTruncate()
 {
     $value = 'very loooooong text lala';
     $format = ['length' => 10, 'etc' => ' usw.', 'break_words' => true];
     $this->assertEquals('very  usw.', rex_formatter::truncate($value, $format));
     // XXX hmm seems not to be correct
     $format = ['length' => 10, 'etc' => ' usw.', 'break_words' => false];
     $this->assertEquals('very usw.', rex_formatter::truncate($value, $format));
 }