getShortName()
function getShortName(fullName: string): string;
Returns a person's first name and the initial of their last name, such as Richard A. for
Richard Dean Anderson.
- Status text is left out as it is for getFirstName, so
Ada Lovelace (OOO Friday)givesAda L., notAda F.. - The initial comes from the last word rather than the second, because in a name of three or more words the last one is usually the family name.
- The initial is a whole character as the reader sees it, so an accent or an Indic conjunct
stays with its letter:
Shreya श्रीवास्तवgivesShreya श्री.. - A word that doesn't start with a letter, such as a trailing emoji, is skipped, so
Ana Silva 🌴givesAna S.. When no word after the first starts with a letter, as inRobot 🤖or a one-word name, the first name is returned alone.
Parameters
| Parameter | Type | Description |
|---|---|---|
fullName | string | The person's full name, such as a user's name or fullName |
Returns
string
The first name and last initial, the first name alone when there's no initial, or an empty string for a blank name