How to mask string?

后端 未结 5 723
温柔的废话
温柔的废话 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:30

    This produces the required result

    string result = Int64.Parse(s.Remove(5,2)).ToString("00-000-000000");
    

    assuming that you want to drop 2 characters at the position of the 2 first nulls.

提交回复
热议问题