note 97948 added to function.sprintf
| From: | Hellen at osu1 dot php dot net | Date: | Tue, 18 May 2010 00:34:07 +0000 |
| Subject: | note 97948 added to function.sprintf | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-169336@lists.php.net to get a copy of this message | ||
$s = 'monkey';
printf("[%-10s]\n", $s);
Output: [monkey ]
$s = 'the monkey is in the jungle';
printf("[%-10s]\n", $s);
Output: [the monkey is in the jungle]
But I want the output: [the mokey ]
Can I cut the right characters in the string, and leave the output with 10 characters?
Thanks!
----
Server IP: 69.147.83.197
Probable Submitter: 189.3.108.50
----
Manual Page -- http://www.php.net/manual/en/function.sprintf.php
Edit -- https://master.php.net/note/edit/97948
Del: integrated -- https://master.php.net/note/delete/97948/integrated
Del: useless -- https://master.php.net/note/delete/97948/useless
Del: bad code -- https://master.php.net/note/delete/97948/bad+code
Del: spam -- https://master.php.net/note/delete/97948/spam
Del: non-english -- https://master.php.net/note/delete/97948/non-english
Del: in docs -- https://master.php.net/note/delete/97948/in+docs
Del: other reasons-- https://master.php.net/note/delete/97948
Reject -- https://master.php.net/note/reject/97948
Search -- https://master.php.net/manage/user-notes.php