Re: padding with spaces



IchBin 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?


This is an HTML question, not a PHP question.

HTML compresses multiple blanks into a single one. To have a non-breaking space you need to use &nbsp;

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@xxxxxxxxxxxxx
==================
.



Relevant Pages

  • Re: padding with spaces
    ... Jerry Stuckle wrote: ... zeros as in this code: ... It is not padding all the spaces but only one space. ... Even with left justification: ...
    (comp.lang.php)
  • Re: padding with spaces
    ... | zeros as in this code: ... It is not padding all the spaces but ... Right justification: ... Remove your pants to reply ...
    (comp.lang.php)
  • Re: Website border issue
    ... Publisher produces fixed width pages, that are left justified by design. ... Understanding background padding in a Publisher web (aka white ... If you find all this too tedious, then work with the left justification. ...
    (microsoft.public.publisher.webdesign)
  • Re: Q on Riemann Hypothesis
    ... although that function has the same zeros. ... It requires a little justification, because the series is not absolutely ... convergent. ... Things like differentiation under the integral therefore blow ...
    (sci.math)