contacts.splitContactName
Automatically split a single string name into 3 separate fields for title, first name and surname respectively.
none
names array (3 elements consisting of title, first name and surname respectively)
local names = {};
names = contacts.splitContactName("Mr Luke Skywalker")
print("'" .. names.title .. "' '" .. names.firstName .. "' '" .. names.surname .. "'")
names = contacts.splitContactName("Mr Have Fancy-Surname")
print("'" .. names.title .. "' '" .. names.firstName .. "' '" .. names.surname .. "'")
names = contacts.splitContactName("Mr Two First Names")
print("'" .. names.title .. "' '" .. names.firstName .. "' '" .. names.surname .. "'")
names = contacts.splitContactName("Dr. Emmett Brown")
print("'" .. names.title .. "' '" .. names.firstName .. "' '" .. names.surname .. "'")
names = contacts.splitContactName("Prof Albert Einstein")
print("'" .. names.title .. "' '" .. names.firstName .. "' '" .. names.surname .. "'")
names = contacts.splitContactName("Mr and Mrs John Doe")
print("'" .. names.title .. "' '" .. names.firstName .. "' '" .. names.surname .. "'")
names = contacts.splitContactName("Mr & Mrs John Doe")
print("'" .. names.title .. "' '" .. names.firstName .. "' '" .. names.surname .. "'")
names = contacts.splitContactName("Mr/Mrs John Doe")
print("'" .. names.title .. "' '" .. names.firstName .. "' '" .. names.surname .. "'")
names = contacts.splitContactName("Mr / Mrs John Doe")
print("'" .. names.title .. "' '" .. names.firstName .. "' '" .. names.surname .. "'")
names = contacts.splitContactName("Mr + Mrs John Doe")
print("'" .. names.title .. "' '" .. names.firstName .. "' '" .. names.surname .. "'")
Generated on the 26 June 2024 at 22:01:27 (UK Time)