RE: str_pad clarification - Re: [PHP-DEV] PHP Unicode strings impl proposal

From: Date: Thu, 01 Sep 2005 13:32:50 +0000
Subject: RE: str_pad clarification - Re: [PHP-DEV] PHP Unicode strings impl proposal
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-18645@lists.php.net to get a copy of this message
> So for reasons of performance, simplicity, and practicality, I would > say str_pad should: > > 1) of course surrogates must not be broken up > 2) The pad string can have combining characters. > 3) The length the user specifies should be a character count. I presume that "character" above refers to codepoint, and not UChar. > 4) The string can be truncated to the user's requested character > length. The string will be trimmed from the right one unicode utf-8 > character (not grapheme, not byte) at a time until the length limit is > met. (So a combining character is one character for this purpose.) Shouldn't characters/codepoints be trimmed at both ends, rather than just at the right end ?

« previous php.internals (#18645) next »