Pad left with zeroes

前端 未结 4 813
盖世英雄少女心
盖世英雄少女心 2020-12-01 12:21

I want to pad left every number with zeroes (it has to be 8 digits) in my string.

e.g.

asd 123 rete > asd 00000123 rete
4444 my text > 00004444         


        
4条回答
  •  猫巷女王i
    2020-12-01 12:44

    If you don't have any attachment to Regex just use format strings:

    C# convert int to string with padding zeros?

    http://www.xtremedotnettalk.com/showthread.php?t=101461

提交回复
热议问题