src/Util/Strings.php
public static function padLeft(string $s, int $length, string $pad = ' '): string
    {
        $length -= \mb_strlen($s);
        if ($length <= 0) {
            return $s;
        }

        $padLen = \mb_strlen($pad);

        return \str_repeat($pad, (int) ($length / $padLen)) . \mb_substr($pad, 0, $length % $padLen) . $s;
    }
public static function padLeft(string $s, int $length, string $pad = ' '): string
    {
        $length -= \mb_strlen($s);
        if ($length <= 0) {
            return $s;
        }

        $padLen = \mb_strlen($pad);

        return \str_repeat($pad, (int) ($length / $padLen)) . \mb_substr($pad, 0, $length % $padLen) . $s;
    }
public static function padLeft ( string $ s , int $ length , string $ pad = ' ' ) : string { $ length -= \ mb_strlen ( $ s ) ; if ( $ length <= 0 ) { return $ s ; } $ padLen = \ mb_strlen ( $ pad ) ; return \ str_repeat ( $ pad , ( int ) ( $ length / $ padLen ) ) . \ mb_substr ( $ pad , 0 , $ length % $ padLen ) . $ s ; }
Pad a UTF-8 string to a certain length with another string.

@param  string $s UTF-8 encoding
@param  int    $length
@param  string $pad

@return string
Pad a UTF - 8 string to a certain length with another string .