Sign in to follow this  
Followers 0
barryb

Splitting first name surname with spaces [SOLVED]

3 posts in this topic

#1 ·  Posted (edited)

Hi Guys,

I am looking at splitting first name / surname so I can do AD lookups, now problem is the input file is not csv :D but a flat firstname 'space' surname, again not much of a problem BUT some users have double barrel surnames e.g. lin san san.

Is there anyway for autoit to split on first space so I only have a 2 element array? Or do I split on the space then count the number of elements in the array to determine if i have a double barrel scenario?

Any pointers would be appreciated.

Thanks,

Barry

Edited by barryb

Share this post


Link to post
Share on other sites



#include <array.au3> ; used with _ArrayDisplay()

Dim $s_name = "My Name Is"
Dim $a_sre = StringRegExp($s_name, "(.+?)\s(.+?)", 1)
_ArrayDisplay($a_sre, "Name split by 1 space")


Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Share this post


Link to post
Share on other sites

#include <array.au3> ; used with _ArrayDisplay()

Dim $s_name = "My Name Is"
Dim $a_sre = StringRegExp($s_name, "(.+?)\s(.+?)", 1)
_ArrayDisplay($a_sre, "Name split by 1 space")
Arrrrghh why didn't I think about regular expression!!! This has been bugging me since Friday lol. :D

Thanks Smoke_N virtual pint heading your way :o

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  
Followers 0