Solved

Find a subset in a string

Posted on 1998-10-26
3
146 Views
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?
0
Comment
Question by:pjroy
  • 2
3 Comments
 
LVL 3

Accepted Solution

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

Expert Comment

by:dabellei
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)

0
 
LVL 3

Expert Comment

by:traygreen
ID: 1441645
Yep, sorry I forgot the -1
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying 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

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…
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

820 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