Link to home
Start Free TrialLog in
Avatar of IUAATech
IUAATech

asked on

prepend a string to an exisiting string

I am looking to prepend 10-x #s of  0's to a string if its lenth is less than 10 and has a length x.

so if I have 12345 I want to end up with 0000012345.

What a short and sweet way of doing this? :)

Thanks.
SOLUTION
Avatar of PoeticAudio
PoeticAudio

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of PoeticAudio
PoeticAudio

if your 12345 is an integer then you don't have to Convert.ToInt32(a) in the format, but if it's a string then you will, or else the leading 0's will not come through
ASKER CERTIFIED SOLUTION
Avatar of Mike Tomlinson
Mike Tomlinson
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
PadLeft is actually the way to go on this... duh! Why didn't I think of that?
Avatar of IUAATech

ASKER

thanks guys.