Hi I have a string which is "Track 04 (3.51)". I'd like to be able to rip the information in the string so I have:
strTrackName = "Track 04"
strDuration = "3.51"
Anyone know a good way of doing this? Thanks in advance.
Printable View
Hi I have a string which is "Track 04 (3.51)". I'd like to be able to rip the information in the string so I have:
strTrackName = "Track 04"
strDuration = "3.51"
Anyone know a good way of doing this? Thanks in advance.
:)VB Code:
Dim strInfo As String = "Track 04 (3.51)" Dim strTrackName As String = strInfo.Substring(0, strInfo.IndexOf("(") - 1) Dim c As Char() = "()".ToCharArray Dim strDuration As String = strInfo.Split(c)(1) MessageBox.Show("Track: " & strTrackName & Environment.NewLine & "Time: " & strDuration)
Hi
This may work.I did not run it , just writing directly(just check for silly mikstakes if any).
Made it simple for u :
Dim origStr as String = "Track 04 (3.51)"
Dim newStr1 as String
Dim newStr2 as String
Dim pos1,pos2 as Integer
pos1 = origStr.IndexOf("(")
pos2 = origStr.IndexOf(")")
newStr1 = origStr.Substring(0,pos1-1)
newStr2 = origStr.Substring(pos1,(pos2-pos1-1))