天天看點

C#補位函數PadLeft和PadRight

左邊補位

PadLeft

用法:

string str = "100";

str.PadLeft(5,'0')

輸出:00100

右邊補位

PadRight

str.PadRight(5, '0')

輸出:10000