Skip to main content

getFirstName()

function getFirstName(fullName: string): string;

Returns the first word of a person's name, or an empty string if the name is blank.

Status text people add to their display name isn't part of the name. Anything after a |, @ or dash with spaces around it is left out, as is a trailing OOO or note in parentheses, so Ada Lovelace (OOO Friday) and Ada Lovelace @ Paternity Leave both read as Ada Lovelace.

Parameters​

ParameterTypeDescription
fullNamestringThe person's full name, such as a user's name or fullName

Returns​

string

The first name, or an empty string for a blank name