Remove last specific character in a string c#

前端 未结 8 1295
梦谈多话
梦谈多话 2020-12-13 23:16

I use WinForms c#.I have string value like below,

string Something = \"1,5,12,34,\";

I need to remove last comma in a string. So How can i

相关标签:
8条回答
  • 2020-12-13 23:39

    Try below

    Something..TrimEnd(",".ToCharArray());

    0 讨论(0)
  • 2020-12-13 23:42
    Dim psValue As String = "1,5,12,34,123,12"
    psValue = psValue.Substring(0, psValue.LastIndexOf(","))
    

    output:

    1,5,12,34,123
    
    0 讨论(0)
提交回复
热议问题