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
In reply to Re: How to convert a string with regex to a string with a fixed length?
by olus
in thread How to convert a string with regex to a string with a fixed length?
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |