Show value of string only to sign

  • Thread starter Thread starter Mrozu
  • Start date Start date
M

Mrozu

Hi

I need function which can show me value of string only TO seted sign.
For example i have string

x="Hello, people"

and i need function which show me string to ",", in this situation
Hello, other example

x="1111 | 22222"

show me only to "|", 1111

Is it possible??

thx
 
Mrozu said:
Hi

I need function which can show me value of string only TO seted sign.
For example i have string

x="Hello, people"

and i need function which show me string to ",", in this situation
Hello, other example

x="1111 | 22222"

show me only to "|", 1111

Is it possible??

thx

Dim Answer() as String
1. Answer = String.Split(",")
Debug.writeline(Answer(0))
2. Answer = String.Split("|")
Debug.writeline(Answer(0))

Chris
 
Mrozu said:
I need function which can show me value of string only TO seted sign.
For example i have string

x="Hello, people"

and i need function which show me string to ",", in this situation
Hello, other example

x="1111 | 22222"

show me only to "|", 1111

Is it possible??

Take a look at 'Strings.Split' and the 'String' objects' 'Split' method.
 
hmm it doesn't work:/
my code:

Dim a As String

a = "ALA|AS"
MsgBox(a.Split("|"))

it is error in line MsgBox(a.split("|")) :

An unhandled exception of type 'System.ArgumentException' occurred in
microsoft.visualbasic.dll

Additional information: Argument 'Prompt' cannot be converted to type
'String'.

What's wrong??
 
Mrozu said:
Dim a As String

a = "ALA|AS"
MsgBox(a.Split("|"))

it is error in line MsgBox(a.split("|")) :

An unhandled exception of type 'System.ArgumentException' occurred in
microsoft.visualbasic.dll

\\\
Dim Text As String = "ALA|AS"
Dim Words() As String = Text.Split("|"c)
For Each Word As String In Words
MsgBox(Word)
Next Word
///
 

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