Skip to content
+1-888-319-3663

COMMUNITY FORUM

Parse Contact Name

Bill asked 3 years ago
Is there a function to parse a contact name (Mike J Lee, Mike Smith) to get first name Mike and last name Lee?
Thank you!
Answers
Patrick Roth Staff answered 3 years ago
There isn’t anything in smartconnect that would do this automatically.
However asking google, I found a couple of links I like:
https://www.tek-tips.com/viewthread.cfm?qid=1151795
https://social.msdn.microsoft.com/forums/en-US/167490b9-f489-4ac4-b294-947f42c4dabe/breaking-apart-full-name-into-first-and-last-name-in-vbnet
There are others.
Obviously it is way easier to put a full name together than split one out but with some assumptions that should be do-able.
The thing interesting in your example is that one has 3 values and the other just 2.  So you would have to adapt for that as well.
Using the string.split() method is your best bet and then if you have 3 elements in your array you would guess you have first/middle/last.  And if have two then just first/last.
And if just one – then either Prince, Madonna, or Cher (ie first name only)
 
 

If you would like to submit an answer or comment, please sign in to the eOne portal.