Proper Case Surname 📛

Danny Roden
Danny Roden Administrator
edited December 2023 in Functions library


This package contains 2x functions which help with contact data: Proper Case Surname and Validate Surname Casing.

Proper Case Surname

As the name suggests this function, produces a proper-cased Surname for a given input, taking into account some key exceptions including: Irish & Scottish names (e.g. O'Neil and McDonald) as well as hyphenated/double-barrel names (such as McDonald-O'Neil). This is useful for quickly standardising names for presentation purposes.

See below for a preview of the logic used to define this transformation:

Note a sub-function is also included within this package called 'Celtic Surname Correction' which is defined below (note that this can very easily be edited to include any additional exceptions you may identify throughout your profile/discovery process):

Validate Surname Casing

The second key function acts as a rule to help identify the extend to which contact data is presented in a consistent manner (in terms of formatting/casing). Note that this should be used in addition to checks such as 'Contains Only Valid Characters for Names'.

As you can see from the below function definition, the rule here simply evaluates if the input is adhering to the standard form (as defined in the above function):


These functions are compatible with all instances of Data Studio from v2.1.11 onwards.