Hi,

I have a string like "a_b_c_d". How do I get only c out of this string?

Thanks

dim str as string = "a_b_c_d"
dim justc as string
justc = str.split("_")(2)

i hope this ll help

Also, see if this helps.

Dim sTemp As String = "a_b_c_d" '// your String.
        Dim arTemp() As String = sTemp.Split("_"c) '// .Split String into Arrays.
        For Each itm As String In arTemp '// loop thru Arrays.
            '// find your Array and get value.
            If itm.StartsWith("c") Then MsgBox(itm)
        Next

Thanks all! I've used split.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.