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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Send outlook email from VBS Script 2 67
Publisher:   Unknown     VB.exe Application 1 32
Sub or Function is not defined 6 59
SQL Server 2012 to SQL Server 2016 24 57
Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…

752 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