C#  字符串PadLeft函数的使用

1.Demo:

需求:

将111改变成0000111

使用字符串PadLeft函数可以解决:

int num = 111;     

string s= num.ToString();

s= s.PadLeft(7, '0');

Console.WriteLine(s);//s输出: 0000111

 

 

相关文章:

  • 2021-10-16
  • 2022-02-21
  • 2021-06-08
  • 2022-01-23
  • 2021-11-18
  • 2022-12-23
  • 2021-10-03
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-09-09
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案