Client gave me a request to generate product code for products. The code has to be generated from 001 -> 0xx -> xxx based on the request params.
Ruby support this syntax "%03d" % 12 => 012. This contains 3 part:
%0: 0 character will insert in top of the string, this character can be replaced.
3d: number of max character can be generate, 3d means the string max length is 3.
12: number that we want to insert.
For more information please check this Ruby String
Ruby support this syntax "%03d" % 12 => 012. This contains 3 part:
%0: 0 character will insert in top of the string, this character can be replaced.
3d: number of max character can be generate, 3d means the string max length is 3.
12: number that we want to insert.
For more information please check this Ruby String