Special characters throwing off str_pad in php?

前端 未结 3 830
半阙折子戏
半阙折子戏 2020-12-16 19:26

I\'m writing a module that is supposed to be able to export transaction records in BankOne format.

Here is the specification of the format

Here is an example

3条回答
  •  -上瘾入骨i
    2020-12-16 20:16

    function mb_str_pad($input, $pad_length, $pad_string = ' ', $pad_type = STR_PAD_RIGHT) {
        $diff = strlen($input) - mb_strlen($input,mb_detect_encoding($input));
        return str_pad($input, $pad_length + $diff, $pad_string, $pad_type);
    }
    

提交回复
热议问题