General discussion

Locked

Split String

By bsmgopal1984 ·
Dear all,
I want to split a string into twoparts.
How to do it?
For example, If I assigned variable called usrnm having string "QWUS\M0392".
But I want to split into two parts or I need only "M0392" from the string.How can I get it?
Will Mid or Replace function help for this?
Please help me!
Thanks in advance!

This conversation is currently closed to new comments.

2 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Comments

Collapse -

by NZ_Justice In reply to Split String

use left and right

below is an example, I have outputted the result to two lables . lbl1 and lbl2.

Dim b As String
Dim c As String

b = 12345678
c = 12345678

Left(b, 4)
Right(c, 4)

lbl1.Text = Left(b, 4)
lbl2.Text = Right(c, 4

Collapse -

by mcaris In reply to

I suggest usage of split function it's very simple and I discovered it recently . How could I live without it?

Dim stringToSeparate as string
stringToSeparate="Something\somethingElse"

Dim stringArray() as string
strinArray = split(stringToSeparate,"\")

msgbox(StringArray(0))
msgbox(StringArray(1))

Here U go.

Back to Web Development Forum
2 total posts (Page 1 of 1)  

Related Discussions

Related Forums