#21317 [Opn]: Need mbstring version of str_pad
| From: | moriyoshi@php.net | Date: | Wed, 01 Jan 2003 10:57:15 +0000 |
| Subject: | #21317 [Opn]: Need mbstring version of str_pad | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-28870@lists.php.net to get a copy of this message | ||
ID: 21317
Updated by: moriyoshi@php.net
Reported By: jc@mega-bucks.co.jp
Status: Open
Bug Type: Feature/Change Request
Operating System: Red Hat Linux 7.2
PHP Version: 4.3.0
New Comment:
Okay, let's keep this open. I'll implement it in my spare time.
Yet I have a quetion: what if the length(width) of the input string
cannot be divided by the length of the string to pad with??? Should the
remainder be padded with han-kaku spaces?
Anyway, akemashite omedetou.
Moriyoshi
Previous Comments:
------------------------------------------------------------------------
[2003-01-01 04:32:02] jc@mega-bucks.co.jp
Sorry for unexpected greeting. Akemashite omedetou.
Yes, I am working on New Year's day .. and guess what I was coding ...
an mb version of str_pad ...
I agree that I could roll my own function, and indeed I have done so
using mb_strwidth (though it doesn't work perfectly and I can't figure
out why. Something to do with the fact that the string contains both
full-width and half-width characters I suspect; need more debugging).
But then again the same thing could be said about the str_pad function.
Why was it created? All the needed functionality for a user to create
his own version of str_pad already existed, so there really wasn't a
"need" to create the str_pad function ... But I guess str_pad was such
a useful function to have and was being used by enough people that a
standard PHP function was created.
The basic reason for asking is simply that str_pad exists but does not
work with multibyte strings. I know the developpers probably have a lot
more important things to work on, so all I ask is that it be put on a
TO-DO list, even if at the bottom :)
------------------------------------------------------------------------
[2003-01-01 03:56:36] moriyoshi@php.net
Rather an unexpected new year greeting for me :)
Simply I don't see much need for such feature. Why do you need it?
There are already enough materials to make an equivalent by your own.
------------------------------------------------------------------------
[2003-01-01 02:05:11] jc@mega-bucks.co.jp
Could you add a multibyte version of the str_pad function to the
mbstring library functions?
Thanks,
Jc
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=21317&edit=1