How to split in VB.NET

前端 未结 5 2146
别跟我提以往
别跟我提以往 2020-12-21 19:16

I am using VB.NET code.

I have got the below string.

http://localhost:3282/ISS/Training/SearchTrainerData.aspx

Now I want to split

5条回答
  •  醉梦人生
    2020-12-21 19:20

    Your "string" is obviously a URL which means you should use the System.Uri class.

    Dim url As Uri = New Uri("http://localhost:3282/ISS/Training/SearchTrainerData.aspx")
    Dim segments As String() = url.Segments
    Dim str As String = segments(segments.Length - 1)
    

    This will also allow you to get all kinds of other interesting information about your "string" without resorting to manual (and error-prone) parsing.

提交回复
热议问题