Find a subset in a string

Posted on 1998-10-26
Last Modified: 2010-04-30
Ex.: I have this string "id1##id2##id3". The ## are the delimiter in this string. I want to obtain the first part of this string, so all the caracter before the #. Is there any function in VB to do that?
Question by:pjroy
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2

Accepted Solution

traygreen earned 20 total points
ID: 1441643
Use a combination of Instr and mid
sRawStr = id1##id2##id3
sMyStr = Mid(sRawStr,1,Instr(sRawStr,1, "##"))

Expert Comment

ID: 1441644
text = "id1##id2##id3"
id1 = mid$(text,1,instr(text,"#") - 1)
this will give you id1 for id2

"create a new value for text
text = mid$(text,1,instr(text,"#") + 2)
id2 = mid$(text,1,instr(text,"#") - 1)


Expert Comment

ID: 1441645
Yep, sorry I forgot the -1

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses
Course of the Month5 days, 17 hours left to enroll

627 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