splitting string in 2 parts

A

ashishprem

I have 1 string which contains the value like "25-32". I want to spli
it in 2 strings such that the value of
string1="25"
string2="32"

Please help me out,
Regards.
Ashis
 
B

Bob Phillips

As this is in programming, I guess that you want vba.

ary = Split("25-32", "-")
string1 = ary(0)
string2 = ary(1)


--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)
 
A

Antonio Elinon

This is called parsing, with a delimiter of "-".
Assuming the numbers can be bigger or smaller, use code similar to:

txt = "25-32"
delim="-"
loc = instr(txt,delim)
string1 = mid(txt,1,loc-1)
string2 = mid(txt,loc+1)
 

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

Top