I am getting an input string containing digits with comma (,) separated like these formats
1) X,X
2) X,XX
3) XX,X
My desired format is XX,XX
.
I want if I get the input string like in above 1,2,3 formats it should be formatted as my desired format XX,XX
.
For example,
1) If I get a string in this format 1,12
. I want to put a zero before 1 like this 01,12
.
2) If I get a string in this format 1,1. I want to put a zero before and ofter 1 like this 01,10
.
3) If I get a string in this format 11,1
. I want to put a zero after the last 1 like this 11,10
.
Any help will be highly appreciated, thanks in advance.