in reply to How to convert a string with regex to a string with a fixed length?
Also with sprintf
$barcode = sprintf("%.13s%s", $barcode, "0"x(13-length($barcode)));
update thanks lodin, I misunderstood the question and assumed the input was always 13 or less characters. Fixed now
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: How to convert a string with regex to a string with a fixed length?
by lodin (Hermit) on Jul 29, 2008 at 17:12 UTC |