Jump to content
Sign in to follow this  
michaelslamet

Problem on splitting string

Recommended Posts

michaelslamet

I have a string that can contain a email address, 2 email address(es) or even 3 email address(es)

this is the example of the string:

abc@abc.com

or

abc@abc.com / xyz@xyz.com

or

abc@abc.com / xyz@xyz.com, aaa@aaa.com

A character that separate those address(es) is either / , or ;

How the separate them into $email_adress[1], $email_address[2], $email_address[3]?

I know that StringRegExp should do, but... how?

Thanks a lot!! :mellow:

Share this post


Link to post
Share on other sites
Spiff59

StringSplit will work for you.

Something like:

#include <array.au3>

$string = "paul, bob; jack/bill"
$array = StringSplit($string,",;/")
_ArrayDisplay($array)

For $x = 1 to $array[0]
    $array[$x] = StringStripWS($array[$x], 3)
Next
_ArrayDisplay($array)

Edit: Added the StringStripWS() loop, which you may or may not need.

Edited by Spiff59

Share this post


Link to post
Share on other sites
michaelslamet

Test it just now, works like a charm!! Thats a lot, Spiff59, you rocks!! :mellow:

Thanks again!!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.