printf and unsecable char
am 04.01.2010 19:10:58 von Jean-Philippe BATTU
Hello
I would like to print a string formatted on the right side and fill in
the left side with the unsecable character [ ]
I read in the printf command I could use : printf( "%#30s" , $mystring ) ;
to display $mystring string with the character # before (on the left)
and I try to replace # by but I can't find a solution
Do you know the solution to write the command: printf(
"% 30s" , $mystring ) ;
or something like that !
Best regards and take care !
--
Jean-Philippe Battu
http://jeanpba.homeip.net
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: printf and unsecable char
am 04.01.2010 22:30:24 von dmagick
Jean-Philippe Battu wrote:
> Hello
>
> I would like to print a string formatted on the right side and fill in
> the left side with the unsecable character [ ]
>
> I read in the printf command I could use : printf( "%#30s" , $mystring ) ;
> to display $mystring string with the character # before (on the left)
>
> and I try to replace # by but I can't find a solution
>
> Do you know the solution to write the command: printf(
> "% 30s" , $mystring ) ;
> or something like that !
echo str_repeat(' ', 30);
(if I understand what you're trying to do correctly).
--
Postgresql & php tutorials
http://www.designmagick.com/
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: printf and unsecable char
am 05.01.2010 11:41:03 von Richard Quadling
2010/1/4 Chris :
> Jean-Philippe Battu wrote:
>>
>> Hello
>>
>> I would like  to print a string formatted on the right side and fil=
l in
>> the left side with the unsecable character [ ]
>>
>> I read in the printf command I could use : printf( "%#30s" , $mystring )=
;
>> to display $mystring string with the character # before (on the left)
>>
>> and I try to replace # by but I can't find a solution
>>
>> Do you know the solution to write the command: Â Â Â =C2=
=A0 Â printf(
>> "% 30s" , $mystring ) ;
>> or something like that !
>
> echo str_repeat(' ', 30);
>
> (if I understand what you're trying to do correctly).
>
> --
> Postgresql & php tutorials
> http://www.designmagick.com/
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
$mystring =3D 'Hello, world!';
echo str_replace('#', ' ', str_pad($mystring, 30, '#', STR_PAD_LEFT));
?>
outputs ...
&nb=
sp; Hello,
world!
--=20
-----
Richard Quadling
"Standing on the shoulders of some very clever giants!"
EE : http://www.experts-exchange.com/M_248814.html
Zend Certified Engineer : http://zend.com/zce.php?c=3DZEND002498&r=3D213474=
731
ZOPA : http://uk.zopa.com/member/RQuadling
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php