How to mask string?

后端 未结 5 756
温柔的废话
温柔的废话 2021-01-18 02:51

I have a string with value \"1131200001103\".

How can I display it as a string in this format \"11-312-001103\" using Response.Write(value)?

Thanks

5条回答
  •  南方客
    南方客 (楼主)
    2021-01-18 03:15

    Maybe something like

    string result = str.SubString(0, 2) + "-" + str.SubString(2, 3) + "-" + str.SubString(7);
    

    str being the "11312000011103" string

提交回复
热议问题