Merge pull request #823 from JamesL813/master
Change display mode to add a comma when displaying surname first: "Lastname, Firstname"
This commit is contained in:
commit
d83c14dab9
1 changed files with 9 additions and 1 deletions
|
|
@ -108,7 +108,15 @@ data class Contact(
|
||||||
|
|
||||||
fun getNameToDisplay(): String {
|
fun getNameToDisplay(): String {
|
||||||
val firstMiddle = "$firstName $middleName".trim()
|
val firstMiddle = "$firstName $middleName".trim()
|
||||||
val firstPart = if (startWithSurname) surname else firstMiddle
|
val firstPart = if (startWithSurname) {
|
||||||
|
if (surname.isNotEmpty() && firstMiddle.isNotEmpty()) {
|
||||||
|
"$surname,"
|
||||||
|
} else {
|
||||||
|
surname
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
firstMiddle
|
||||||
|
}
|
||||||
val lastPart = if (startWithSurname) firstMiddle else surname
|
val lastPart = if (startWithSurname) firstMiddle else surname
|
||||||
val suffixComma = if (suffix.isEmpty()) "" else ", $suffix"
|
val suffixComma = if (suffix.isEmpty()) "" else ", $suffix"
|
||||||
val fullName = "$prefix $firstPart $lastPart$suffixComma".trim()
|
val fullName = "$prefix $firstPart $lastPart$suffixComma".trim()
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue