Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27005

VS 2008 [RESOLVED] Split this string into other strings, delete "-" characters

$
0
0
Hi !
I have a string for example:
E0-1D-80-05

I want it to split into 4 other strings, and delete - characers, so it would be like
string1 = EO
string2 = 1D
string3 = 80
string4 = 05

BTW, this E0-1D-80-05 will always look the same, but its random generated, so next time i turn it on it may be like
4E-F3-42-4F etc
//EDIT
Fixed it myself, used
Code:

Dim str = "EO-05-WO-90"

        Dim split = str.Split("-")

        Dim part1, part2, part3, part4 As String

        If (split.Count = 4) Then
            part1 = split(0).ToString()
            part2 = split(1).ToString()
            part3 = split(2).ToString()
            part4 = split(3).ToString()
        End If

(str value was set to this just for testing)

Viewing all articles
Browse latest Browse all 27005

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>