Complex String Manipulation - Well Complex For Me Anyway 
Author Message
 Complex String Manipulation - Well Complex For Me Anyway

I need to be able to do the following to various strings that are presented
to my application, they are all email addresses, and no it is not a mass
emailer app.

My app reads in the sender email address of messages that have been sent to
me, I need to be able to strip and keep the first section of the email
address, which is fine for most addresses but some have extra characters on
them and I also need to strip these of.

i.e

Actual Email Address                                                    The
Bit I Need

god

god

santa claus (no full stop)


also do this for the other addresses, but am not sure exactly how I should
be scanning for these 'extra' characters.

Just in case anybody is interested, i am writing this app to annouce new
email messages using MS Agents, the output form my sound card is pumped into
my house audio system, and works great at present but only for a few
selected email addresses (those formatted like the first one).

Any help much appreciated.



Fri, 02 Jul 2004 11:26:11 GMT  
 Complex String Manipulation - Well Complex For Me Anyway

Quote:

>I need to be able to do the following to various strings that are presented
>to my application, they are all email addresses, and no it is not a mass
>emailer app.

>My app reads in the sender email address of messages that have been sent to
>me, I need to be able to strip and keep the first section of the email
>address, which is fine for most addresses but some have extra characters on
>them and I also need to strip these of.

>i.e

>Actual Email Address                                                    The
>Bit I Need

>god

>god

>santa claus (no full stop)


liberally:

Address = Replace(Address, "<", "")
Address = Replace(Address, ".", " ")

--

http://www.hyperbooks.com/
Metacreator character software now available



Fri, 02 Jul 2004 13:56:16 GMT  
 Complex String Manipulation - Well Complex For Me Anyway

Quote:

> I need to be able to do the following to various strings that are presented
> to my application, they are all email addresses, and no it is not a mass
> emailer app.

> My app reads in the sender email address of messages that have been sent to
> me, I need to be able to strip and keep the first section of the email
> address, which is fine for most addresses but some have extra characters on
> them and I also need to strip these of.

> i.e

> Actual Email Address                                                    The
> Bit I Need

> god

> god

> santa claus (no full stop)


> also do this for the other addresses, but am not sure exactly how I should
> be scanning for these 'extra' characters.

> Just in case anybody is interested, i am writing this app to annouce new
> email messages using MS Agents, the output form my sound card is pumped into
> my house audio system, and works great at present but only for a few
> selected email addresses (those formatted like the first one).

> Any help much appreciated.

You can use the InStr() function to search for the extra characters in
your splitted string. Then, if they exist, just truncate (or replace)
them using the Left(), Right() or Mid() functions.

Yaniv.



Fri, 02 Jul 2004 14:52:57 GMT  
 Complex String Manipulation - Well Complex For Me Anyway
You can use Replace to remove any unwanted characters.

Tom Shelton


Quote:
> I need to be able to do the following to various strings that are
presented
> to my application, they are all email addresses, and no it is not a mass
> emailer app.

> My app reads in the sender email address of messages that have been sent
to
> me, I need to be able to strip and keep the first section of the email
> address, which is fine for most addresses but some have extra characters
on
> them and I also need to strip these of.

> i.e

> Actual Email Address
The
> Bit I Need

> god

> god

> santa claus (no full stop)


can
> also do this for the other addresses, but am not sure exactly how I should
> be scanning for these 'extra' characters.

> Just in case anybody is interested, i am writing this app to annouce new
> email messages using MS Agents, the output form my sound card is pumped
into
> my house audio system, and works great at present but only for a few
> selected email addresses (those formatted like the first one).

> Any help much appreciated.



Fri, 02 Jul 2004 15:19:22 GMT  
 Complex String Manipulation - Well Complex For Me Anyway

You could adapt it if you want to leave in upper case or numerics

Option Explicit

Private Sub Command1_Click()
Dim myArray() As String
Dim mystring As String
Dim i As Integer



mystring = myArray(0)

Print mystring
' Chr$(97)=a :Chr$(122)=z
For i = 1 To 96
    If InStr(mystring, Chr$(i)) > 0 Then
     mystring = Replace$(mystring, Chr$(i), " ")
     End If
Next i

For i = 123 To 255
    If InStr(mystring, Chr$(i)) > 0 Then
     mystring = Replace$(mystring, Chr$(i), " ")
     End If
Next i

Print mystring
End Sub


Quote:
> I need to be able to do the following to various strings that are
presented
> to my application, they are all email addresses, and no it is not a mass
> emailer app.

> My app reads in the sender email address of messages that have been sent
to
> me, I need to be able to strip and keep the first section of the email
> address, which is fine for most addresses but some have extra characters
on
> them and I also need to strip these of.

> i.e

> Actual Email Address
The
> Bit I Need

> god

> god

> santa claus (no full stop)


can
> also do this for the other addresses, but am not sure exactly how I should
> be scanning for these 'extra' characters.

> Just in case anybody is interested, i am writing this app to annouce new
> email messages using MS Agents, the output form my sound card is pumped
into
> my house audio system, and works great at present but only for a few
> selected email addresses (those formatted like the first one).

> Any help much appreciated.



Fri, 02 Jul 2004 20:41:05 GMT  
 Complex String Manipulation - Well Complex For Me Anyway
Give this a try...



For X = 1 To Len(NamePart)
  If Mid$(NamePart, X, 1) Like "[!a-zA-Z]" Then
    Mid$(NamePart, X) = " "
  End If
Next

Rick

Quote:

> I need to be able to do the following to various strings that are presented
> to my application, they are all email addresses, and no it is not a mass
> emailer app.

> My app reads in the sender email address of messages that have been sent to
> me, I need to be able to strip and keep the first section of the email
> address, which is fine for most addresses but some have extra characters on
> them and I also need to strip these of.

> i.e

> Actual Email Address                                                    The
> Bit I Need

> god

> god

> santa claus (no full stop)


> also do this for the other addresses, but am not sure exactly how I should
> be scanning for these 'extra' characters.

> Just in case anybody is interested, i am writing this app to annouce new
> email messages using MS Agents, the output form my sound card is pumped into
> my house audio system, and works great at present but only for a few
> selected email addresses (those formatted like the first one).

> Any help much appreciated.



Fri, 02 Jul 2004 21:01:24 GMT  
 Complex String Manipulation - Well Complex For Me Anyway
Excellent, I will see what I can come up with form the ideas given to me
here, again, thanks to all those that replied.


Quote:
> I need to be able to do the following to various strings that are
presented
> to my application, they are all email addresses, and no it is not a mass
> emailer app.

> My app reads in the sender email address of messages that have been sent
to
> me, I need to be able to strip and keep the first section of the email
> address, which is fine for most addresses but some have extra characters
on
> them and I also need to strip these of.

> i.e

> Actual Email Address
The
> Bit I Need

> god

> god

> santa claus (no full stop)


can
> also do this for the other addresses, but am not sure exactly how I should
> be scanning for these 'extra' characters.

> Just in case anybody is interested, i am writing this app to annouce new
> email messages using MS Agents, the output form my sound card is pumped
into
> my house audio system, and works great at present but only for a few
> selected email addresses (those formatted like the first one).

> Any help much appreciated.



Sat, 03 Jul 2004 04:54:49 GMT  
 
 [ 7 post ] 

 Relevant Pages 

1. A better method to print complex forms?

2. complex ado query best way to do

3. Serializing a complex XML string

4. String Formula Too Complex

5. string formula too complex

6. "String Formula Too Complex"?

7. String formula too complex?

8. String formula too complex

9. Complex String Help

10. String formula too complex error

11. String Formula Too Complex Error

12. VB3.0 : String formula too complex

 

 
Powered by phpBB® Forum Software