|
-
Nov 25th, 2003, 11:03 AM
#1
Thread Starter
Lively Member
Separating A String Into Strings?
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.
-
Nov 25th, 2003, 11:34 AM
#2
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)
~
if a post is resolved, please mark it as [Resolved]
protected string get_Signature(){return Censored;}
[vbcode][php] please use code tags when posting any code [/php][/vbcode]
-
Nov 26th, 2003, 05:24 AM
#3
Hyperactive Member
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))
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|