Solved

Find a subset in a string

Posted on 1998-10-26
3
140 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
Comment Utility
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
Comment Utility
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
Comment Utility
Yep, sorry I forgot the -1
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

772 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now