How to format the string "abc" with "000000000abc" in c#?
It's very simple.
You can use the method PadLeft of the string object.
This method has two parameters.
The first is the number of times that the character will repeat.
The second is the Char value to repeat.
string str;
char charzero;
str = "abc";
charzero = '0';
string Result = str.PadLeft(9, charzero);