You are here: Re: padding with spaces « PHP Programming Language « IT news, forums, messages
Re: padding with spaces

Posted by Jeff North on 11/28/06 21:40

On Tue, 28 Nov 2006 15:51:44 -0500, in comp.lang.php IchBin
<weconsul@ptd.net>
<RN-cnRzJ39H5PPHYUSdV9g@ptd.net> 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 &nbsp; for the spaces to be displayed.
---------------------------------------------------------------
jnorthau@yourpantsyahoo.com.au : Remove your pants to reply
---------------------------------------------------------------

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация