Link to home
Start Free TrialLog in
Avatar of vindog26
vindog26

asked on

need help with the mid and instr functions

I'm trying to use the mid and instr functions to pull a substring from a string like this example:

"JTTTT0645T383"TUCKER, JAMmES"9999999999999999999999999""6/27/2037"""1/1/1900""

I would like to receive this value:
JTTTT0645T383

The string ALWAYS begins w/ quotes and is ALWAYS delimited with quotes. I need the first value within the quotes returned.

please give me some ideas, thanks
ASKER CERTIFIED SOLUTION
Avatar of PaulHews
PaulHews
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of DatabaseMX (Joe Anderson - Former Microsoft Access MVP)
Left(YourString, Instr(1,YourString,Chr(34))-1)

try that ...

mx
where is this substring coming from?

You could just

#include <string>
using namespace std;

int pos1,pos2;

string str = // your string

pos1 = str.find('\"');
pos1 = str.find('\"', pos1 + 1);

string result = str.substr(pos1 + 1, pos 2 - pos1 - 1);
Access
C++
Visual Basic

Which one is it ?
Avatar of vindog26
vindog26

ASKER

I actually had to go w/ this.
Mid$([val], 1, InStr(2, [val], """") - 1)
 but close enough, thankx!