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?
Actually I am using ASP.Net
Please help me!
Thanks in advance!

This conversation is currently closed to new comments.

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 lowlands In reply to Split String

thought i answered it for you before:

http://techrepublic.com.com/5208-11196-0.html?forumID=51&threadID=198705&start=0

You don't mention what script language you are using, but for vbscript the following example will work:

str = "QWUS\M0392"
a = Split(str, "\")
wscript.echo a(1)

So the Split function will work for you.

http://msdn2.microsoft.com/en-us/library/6x627e5f.aspx

Related Discussions

Related Forums