|
-
Oct 16th, 2007, 07:23 AM
#1
Thread Starter
Addicted Member
[RESOLVED] String Function Help
Hi All,
I have a string that I need to extract only a certain part of the data from:
SMTP:[email protected]
I need to extrapolate "Mike.Smith" from the above string.
I have about 1,000 strings like this, the FirstName.LastName will change on each sting.
How do I parse out the "SMTP:" and the "@abc.com"?
Thank you all for your help!
-
Oct 16th, 2007, 10:32 AM
#2
Re: String Function Help
There are a number of way but here is one.
Code:
Option Explicit
Dim strIn
Dim strParts
strIn = "SMTP:[email protected]"
' Split the string on the ampersand
strParts = Split(strIn, "@")
' You will now have an array that contains
' SMTP:Mike.Smith as the first element and
' abc.com as the second element
' Now remove the first 5 characters of the first element
strParts(0) = Mid(strParts(0), 6)
MsgBox strParts(0)
-
Oct 17th, 2007, 03:44 AM
#3
Addicted Member
Re: String Function Help
if its always gonna be the same domain bit then you could also
Code:
Replace(Replace(EmailAddressHere, "@abc.com", ""), "SMTP:", "")
that will strip off the domain name and the smtp bit but if there are going to bve different things after the "@" then i would definately go with MarkT's method
-
Oct 17th, 2007, 07:35 AM
#4
Thread Starter
Addicted Member
Re: String Function Help
Awesome, thank you guys!
Your explanations and help is why I love coming to this site. Thank you both very much.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|