|
-
Mar 15th, 2009, 05:35 PM
#1
Thread Starter
Addicted Member
[2005] Separation of variable
Hello! I need code for separation of one word from array in bracket.
For example:
Word1 (Word2)
What I want, is to separate Word1 on the one side and Word2 on the other side.
Thanks!
-
Mar 15th, 2009, 05:48 PM
#2
Re: [2005] Separation of variable
So this is a string?
In which case;
Code:
Dim s As String = "Word1 (Word2)"
Dim a As String = s.Substring(0, s.IndexOf(" "))
Dim b As String = s.Substring(s.IndexOf("(") + 1, s.Length - s.IndexOf("(") - 2)
-
Mar 15th, 2009, 05:53 PM
#3
Thread Starter
Addicted Member
Re: [2005] Separation of variable
Yes, but Word1 and Word2 are variables from textbox! Which code in this case?
-
Mar 15th, 2009, 05:55 PM
#4
Re: [2005] Separation of variable
So this string appears in a TextBox?, is that right?
Code:
Dim s As String = TextBox1.Text
Dim a As String = s.Substring(0, s.IndexOf(" "))
Dim b As String = s.Substring(s.IndexOf("(") + 1, s.Length - s.IndexOf("(") - 2)
-
Mar 15th, 2009, 06:06 PM
#5
Thread Starter
Addicted Member
Re: [2005] Separation of variable
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
|