github.com/blend/go-sdk@v1.20220411.3/names/name.go (about) 1 /* 2 3 Copyright (c) 2022 - Present. Blend Labs, Inc. All rights reserved 4 Use of this source code is governed by a MIT license that can be found in the LICENSE file. 5 6 */ 7 8 package names 9 10 // Name is a structured/parsed name. 11 type Name struct { 12 Salutation string 13 FirstName string 14 MiddleName string 15 LastName string 16 Suffix string 17 } 18 19 // String returns the string representation of a name. 20 func (n Name) String() string { 21 fullName := "" 22 23 if n.Salutation != "" { 24 fullName += n.Salutation 25 } 26 27 if n.FirstName != "" { 28 if fullName != "" { 29 fullName += " " 30 } 31 fullName += n.FirstName 32 } 33 34 if n.MiddleName != "" { 35 if fullName != "" { 36 fullName += " " 37 } 38 fullName += n.MiddleName 39 } 40 41 if n.LastName != "" { 42 if fullName != "" { 43 fullName += " " 44 } 45 fullName += n.LastName 46 } 47 if n.Suffix != "" { 48 if fullName != "" { 49 fullName += " " 50 } 51 fullName += n.Suffix 52 } 53 54 return fullName 55 }