Dear All,

This question sounds very simple but I don't know where I am wrong. I just want 
to pad leading zeros in some string, for example, "123" becomes "00123". What 
is wrong if I do following?

> sprintf("%05s", "123")
[1] "  123"


It didn't return "00123", instead it padded with 'blank'.


Thank you for your help in advance.

HXD

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to