string

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a many strings that I need to insert into my Database.
Many of the strings ends with (xxxxxxxxx), (yyy), (fffffff), etc. and I
would like to skip reading that part.. what is the best way to read my string
until the first ( and skip the all after???? in VB .net
LZ
 
:
:I have a many strings that I need to insert into my Database.
: Many of the strings ends with (xxxxxxxxx), (yyy), (fffffff), etc. and I
: would like to skip reading that part.. what is the best way to read my
: string until the first ( and skip the all after???? in VB .net
: LZ


Dim S1 As String
Dim S2 As String

S1 = "abcdefg(xxxxx)"

S2 = Left(S1, Instr(S1, "(") - 1)

'S2 now equals "abcdefg"
 
Here's how I do it.

Dim S1 as String = "abcdefg(xxxxx)"
Dim S2() as String

'This will split the string on the specified char.
S2 = S1.Split("(")

'S2(0) now equals "abcdefg"
'S2(1) now equals "xxxxx)"
 
Lamis said:
I have a many strings that I need to insert into my Database.
Many of the strings ends with (xxxxxxxxx), (yyy), (fffffff), etc. and I
would like to skip reading that part.. what is the best way to read my
string
until the first ( and skip the all after???? in VB .net


Check out the string object's 'TrimEnd' method.
 
Lamis,

I would go for the sample from Anon or this one
\\\
Dim a As String = "aaa(bbbb)"
Dim b As String = a.Substring(0, a.LastIndexOf("("c))
///

I hope this helps,

Cor
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top