Re: padding with spaces
- From: Jeff North <jnorthau@xxxxxxxxxxxx>
- Date: Tue, 28 Nov 2006 21:40:37 GMT
On Tue, 28 Nov 2006 15:51:44 -0500, in comp.lang.php IchBin
<weconsul@xxxxxxx>
<RN-cnRzJ39H5PPHYUSdV9g@xxxxxxx> wrote:
| I am trying to pad a number with spaces to the left. I can pad it with
| zeros as in this code:
|
| printf("<option value='%d'>%04s %s</option>n",
| $row->id,
| $row->NumberOfQuotes,
| arrangeName($row->lastName, $row->firstName, $row->middleName,
| $row->Title, $row->suffix));
|
| Trying to do the same with spaces. It is not padding all the spaces but
| only one space. Right justification:
|
| printf("<option value='%d'>%4s %s</option>n",
| $row->id,
| $row->NumberOfQuotes,
| arrangeName($row->lastName, $row->firstName, $row->middleName,
| $row->Title, $row->suffix));
|
| Even with left justification:
|
| printf("<option value='%d'>%-4s %s</option>n",
| $row->id,
| $row->NumberOfQuotes,
| arrangeName($row->lastName, $row->firstName, $row->middleName,
| $row->Title, $row->suffix));
|
| Does Anyone have any ideas on what I am doing wrong?
The web browser automatically removes multiple spaces.
You will need to use for the spaces to be displayed.
---------------------------------------------------------------
jnorthau@xxxxxxxxxxxxxxxxxxxxx : Remove your pants to reply
---------------------------------------------------------------
.
- References:
- padding with spaces
- From: IchBin
- padding with spaces
- Prev by Date: Re: php 5 classes: public, protected and private
- Next by Date: Re: When to quote?
- Previous by thread: Re: padding with spaces
- Next by thread: PHP to generate XML
- Index(es):
Relevant Pages
|