Get all text to the right of the first left space (1 Viewer)

JohnLee

Registered User.
Local time
Today, 05:32
Joined
Mar 8, 2007
Messages
692
Hi folks,

I'm struggle to find information on how to find the first space on the left of a text string, for examlple:

I have this string : FUJIFILM XM-1 16-50mm BLACK

and I want to find the space between FJUJIFILE and XM

and then get all the text from XM onwards.

I have this expression that gets me so far but then I'm stuck:

Code:
Model: Left([strDescription],InStr(1,[strDescription]," ")-1)

This expresssion gets me FUJIFILM, which isn't want I want.

Any assistance would be most appreciated.

Regards

John
 

JohnLee

Registered User.
Local time
Today, 05:32
Joined
Mar 8, 2007
Messages
692
Hi,

I'm still none the wiser, I want to find the first left space with the string and the get the string to the right of that space.

How does the mid function achieve that.

Regards

John
 

plog

Banishment Pending
Local time
Today, 07:32
Joined
May 11, 2011
Messages
11,653
It gives you more control than LEFT. Mid lets you give it a starting position and then how many characters to run for and pulls all the data between. If you don't tell it how many characters to run for, it goes until the end of the string.

This should do what you want:

Model: Mid([strDescription],InStr([strDescription]," ")+1)
 

JohnLee

Registered User.
Local time
Today, 05:32
Joined
Mar 8, 2007
Messages
692
Hi Plog,

Thank you for doing that, it is much appreciated, what would help me is if you could explain how you came up with that expression, what was your thought process in constructing that expression.

It's something I've always struggled with and any guidance/help on how you determined how to construct that expresion would be most appreciated, so in the future I can start to construct expressions on my own.

Regads

John
 

plog

Banishment Pending
Local time
Today, 07:32
Joined
May 11, 2011
Messages
11,653
I never use Right() or Left(), I only use Mid because it does what both of those can do and more. Whenever I need to extract a substring I always look towards Mid. Just read the link I provided in my first post and it will explain everything it can do.
 

JohnLee

Registered User.
Local time
Today, 05:32
Joined
Mar 8, 2007
Messages
692
Hi Plog,

Thanks for your response and I will read up on the pointer you gave me.

Regards

John
 

Users who are viewing this thread

Top Bottom