Removing all spaces in a string

前端 未结 4 659
无人及你
无人及你 2021-01-21 03:46

Is there any function in vb.net that removes all spaces in a string. I mean a string like \' What is this\' should be \'Whatisthis\'

Thanks Furqan

相关标签:
4条回答
  • 2021-01-21 04:22

    Use String.Replace()

    Dim s As String = " What is this"
    s = s.Replace(" ", "")
    
    0 讨论(0)
  • 2021-01-21 04:22

    You could use String.Replace:

    Dim str As String = " What is this"
    str = str.Replace(" ", "")
    
    0 讨论(0)
  • 2021-01-21 04:23

    I have used str=str.Replace("&nbsp","") with great success.

    However, str=str.Replace(" ","") has not worked for me in the past.

    0 讨论(0)
  • 2021-01-21 04:24

    Using String.Replace:

    Dim Test As String = "Hello Hi"
    Test = Test.Replace(" ", String.Empty)
    
    0 讨论(0)
提交回复
热议问题