[Webinar] Streamline your web hosting managementRegister Today


split a 1 string into 2 strings

Posted on 2008-01-24
Medium Priority
Last Modified: 2013-11-26
I have a string that looks like:

String1= Userid=123 password=1234 CICSID=123 CICSPassword=1234

I would like to create 2 stings that looks like:

String2=  Userid=123 password=1234
String3=  CICSID=123 CICSPassword=1234

I am just not sure how to split this at CICSID-123

Thanks, Chad
Question by:chadmanvb
  • 2
  • 2
LVL 23

Expert Comment

by:Ashish Patel
ID: 20737381
Very easiest method of doing is below, if your string is going to be in same format.

String1= "Userid=123 password=1234 CICSID=123 CICSPassword=1234"

String2= Split(String1, " ")(0) & " "  & Split(String1, " ")(1)
String3= Split(String1, " ")(2) & " "  & Split(String1, " ")(3)

Author Comment

ID: 20737494
Well string1 will change a lot, but one thing that will always be consistant will be "CICSID=".  That is also where I need to split it.  Chad
LVL 23

Accepted Solution

Ashish Patel earned 2000 total points
ID: 20737556
Now try this, as this will always split at CICSID.

String1= "Userid=123 password=1234 CICSID=123 CICSPassword=1234"

String2 = Mid(String1, 1, Instr(1, String1, "CICSID=")-1)
String3 = Mid(String1, Instr(1, String1, "CICSID="))

Author Closing Comment

ID: 31424758
Thanks, that did it.  Chad

Featured Post

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
In real business world data are crucial and sometimes data are shared among different information systems. Hence, an agreeable file transfer protocol need to be established.
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…
Hi, this video explains a free download that you can incorporate into your Access databases, or use stand-alone for contact management. Contacts -- Names, Addresses, Phone Numbers, eMail Addresses, Websites, Lists, Projects, Notes, Attachments…

607 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question