B
Billy N. Patton
My code:
$lcname = 15;
print sprintf("| %-m.ns |\n",$lcname,4,'CELL');
print sprintf("| %m.ns |\n",$lcname,4,'CELL');
print sprintf("| %mns |\n",$lcname,4,'CELL');
print sprintf("| %s |\n",'CELL');
The results:
| %-m.ns |
| %m.ns |
| %mns |
| CELL |
I need the 'CELL' left justified, padded with spaces and using $lcname
space.
The camel book Pg 223 parag 1
The various combinations are fully documented in the manpage for
printf(3), but we'll mention that m is typically the minimum length of a
field (negative for left justified), and n is precision for exponential
formats and the maximum length for other formats. Padding is typically
done with spaces for strings ...
--
___ _ ____ ___ __ __
/ _ )(_) / /_ __ / _ \___ _/ /_/ /____ ___
/ _ / / / / // / / ___/ _ `/ __/ __/ _ \/ _ \
/____/_/_/_/\_, / /_/ \_,_/\__/\__/\___/_//_/
/___/
Texas Instruments ASIC Circuit Design Methodlogy Group
Dallas, Texas, 214-480-4455, (e-mail address removed)
$lcname = 15;
print sprintf("| %-m.ns |\n",$lcname,4,'CELL');
print sprintf("| %m.ns |\n",$lcname,4,'CELL');
print sprintf("| %mns |\n",$lcname,4,'CELL');
print sprintf("| %s |\n",'CELL');
The results:
| %-m.ns |
| %m.ns |
| %mns |
| CELL |
I need the 'CELL' left justified, padded with spaces and using $lcname
space.
The camel book Pg 223 parag 1
The various combinations are fully documented in the manpage for
printf(3), but we'll mention that m is typically the minimum length of a
field (negative for left justified), and n is precision for exponential
formats and the maximum length for other formats. Padding is typically
done with spaces for strings ...
--
___ _ ____ ___ __ __
/ _ )(_) / /_ __ / _ \___ _/ /_/ /____ ___
/ _ / / / / // / / ___/ _ `/ __/ __/ _ \/ _ \
/____/_/_/_/\_, / /_/ \_,_/\__/\__/\___/_//_/
/___/
Texas Instruments ASIC Circuit Design Methodlogy Group
Dallas, Texas, 214-480-4455, (e-mail address removed)