dbTalk Databases Forums  

Strip off Extraneous Characters

comp.databases.ms-access comp.databases.ms-access


Discuss Strip off Extraneous Characters in the comp.databases.ms-access forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
musicloverlch
 
Posts: n/a

Default Strip off Extraneous Characters - 01-25-2012 , 10:50 AM






The CC Email address in SharePoint comes over to Access look like
this: Person Name <PersonEmail (AT) mail (DOT) com>

How would you go about removing everything before and including the
";" and remove everything and including the "&"?

Thanks in advance.

Laura

Reply With Quote
  #2  
Old   
Bob Barrows
 
Posts: n/a

Default Re: Strip off Extraneous Characters - 01-25-2012 , 11:10 AM






musicloverlch wrote:
Quote:
The CC Email address in SharePoint comes over to Access look like
this: Person Name <PersonEmail (AT) mail (DOT) com

How would you go about removing everything before and including the
";" and remove everything and including the "&"?

Your explanation is very confusing. You would have been better off showing
us what you wanted rather than trying to tell us about it. I think you want
to be left with this:

PersonEmail (AT) mail (DOT) com

so it's just a matter of using string functions (Left, Len, Instr, Right,
etc.) to do it. Taking it step-by-step:

1. Strip the last 4 characters:

SELECT Left([CC Email],Len([CCEmail])-4) As FirstStep ...

2. Encapsulate the query in step 1 in a subquery so you don't have to repeat
the calculations and strip the beginning characters by finding the position
of the ; and using that in a Mid function:

SELECT Mid(FirstStep,Instr(FirstStep,";") + 1) As GoodEmail
FROM (
SELECT Left([CC Email],Len([CC Email])-4) As FirstStep ...) As q

using this two-stage approach allows you to test each stage by itself when
debugging.

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.