$i = 0;
foreach ($row as $column) {
if (!isset($columnSize[$i])) $columnSize[$i] = 0;
- $columnSize[$i] = max($columnSize[$i], StringUtil::length(AnsiUtil::stripAnsi($column)));
+ $columnSize[$i] = max($columnSize[$i], mb_strlen(AnsiUtil::stripAnsi($column)));
$i++;
}
}
$i = 0;
foreach ($row as $column) {
$paddedString = StringUtil::pad(AnsiUtil::stripAnsi($column), $columnSize[$i], ' ', (is_numeric($column) ? STR_PAD_LEFT : STR_PAD_RIGHT));
- $result .= ' '.StringUtil::replace(AnsiUtil::stripAnsi($column), $column, $paddedString).' |';
+ $result .= ' '.str_replace(AnsiUtil::stripAnsi($column), $column, $paddedString).' |';
$i++;
}
*/
public static function split($string, $length = 1) {
$result = array();
- for ($i = 0, $max = self::length($string); $i < $max; $i += $length) {
+ for ($i = 0, $max = mb_strlen($string); $i < $max; $i += $length) {
$result[] = mb_substr($string, $i, $length);
}
return $result;
* Alias to php str_pad function with multibyte support.
*/
public static function pad($input, $padLength, $padString=' ', $padType=STR_PAD_RIGHT) {
- $additionalPadding = strlen($input) - self::length($input);
+ $additionalPadding = strlen($input) - mb_strlen($input);
return str_pad($input, $padLength + $additionalPadding, $padString, $padType);
}