i want to find a efficent way to do :
i have a string like :
'1,2,5,11,33'
i want to pad zero only to the numbers that below 10 (have one digit)
so i want to get
'01,02,05,11,33'
thanks
i want to find a efficent way to do :
i have a string like :
'1,2,5,11,33'
i want to pad zero only to the numbers that below 10 (have one digit)
so i want to get
'01,02,05,11,33'
thanks
How much do you really care about efficiency? Personally I'd use:
(As pointed out in the comments, if you're using .NET 3.5 you'll need a call to
ToArray
after theSelect
.)That's definitely not the most efficient solution, but it's what I would use until I'd proved that it wasn't efficient enough. Here's an alternative...
It's horrible code, but I think it will do what you want...