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"9999999999999999999 999999""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
"JTTTT0645T383"TUCKER, JAMmES"9999999999999999999
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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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);
#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 ?
C++
Visual Basic
Which one is it ?
ASKER
I actually had to go w/ this.
Mid$([val], 1, InStr(2, [val], """") - 1)
but close enough, thankx!
Mid$([val], 1, InStr(2, [val], """") - 1)
but close enough, thankx!
try that ...
mx