Moderators IIYAMA Posted June 24, 2014 Moderators Share Posted June 24, 2014 local theString = tostring(2) if string.len(theString) == 1 then theString = 0 .. theString end print(theString) Does anybody knows how to do this shorter? So if there is one character, it will have a zero at front. So: 01 02 03 04 05 06 07 08 09 10-- 2 characters. 11 12 etc. Link to comment
cheez3d Posted June 24, 2014 Share Posted June 24, 2014 local String = ("%02d"):format(4); Link to comment
Moderators IIYAMA Posted June 24, 2014 Author Moderators Share Posted June 24, 2014 Thank you very much, I am not very good with string formats. Link to comment
cheez3d Posted June 24, 2014 Share Posted June 24, 2014 You can find out more about them here: http://www.cplusplus.com/reference/cstdio/printf/ Link to comment
Moderators IIYAMA Posted June 24, 2014 Author Moderators Share Posted June 24, 2014 ah, thank you very much again. Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now