Skip to content

Commit

Permalink
Replace mb_strlen by mb_strwidth
Browse files Browse the repository at this point in the history
  • Loading branch information
ksauvanaud committed Feb 27, 2020
1 parent 4a4a591 commit b9e91e3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/ConsoleTable/Table.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ private function setLines(array $lines): void {
private function addToColumn(string $txt, int $columnIndex): string {
$sizeColumn = $this->headerColumn[$columnIndex]['size'];
$name = self::cutString($txt, $sizeColumn);
$seperate = self::charGenerator(($sizeColumn - mb_strlen($name))," ");
$seperate = self::charGenerator(($sizeColumn - mb_strwidth($name))," ");
$marginChar = self::charGenerator($this->mlr," ");
return "|" . $marginChar . $name . $seperate . $marginChar;
}
Expand Down Expand Up @@ -160,7 +160,7 @@ private function parseDataTitleColumns(array $columns): array {
// The default size column is not set, get the longest str length from line or header title.
if(!$this->defaultSizeCol){
$maxLengthLine = $this->getMaxLengthStr($this->lines[$key]);
$sizeHeader = mb_strlen($col['name']);
$sizeHeader = mb_strwidth($col['name']);
$col['size'] = $maxLengthLine > $sizeHeader ? $maxLengthLine : $sizeHeader;
}

Expand Down

0 comments on commit b9e91e3

Please sign in to comment.