Skip to content

Commit

Permalink
[Enh]: Last Name First & Alphabetization
Browse files Browse the repository at this point in the history
- Extract lastNameFirst to MpName
- For alphabetization, ignore periods after initials
  • Loading branch information
seandenigris committed Apr 23, 2024
1 parent 7802c76 commit 2b55353
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
12 changes: 12 additions & 0 deletions src/MyPeople/MpName.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,18 @@ MpName >> lastNameDescription [
yourself
]

{ #category : #accessing }
MpName >> lastNameFirst [
^ String streamContents: [ :str |
self lastName ifNotNil: [ :n |
str << n ].
str << ', '.
self firstName ifNotNil: [ :n |
str << n ].
self middleName ifNotNil: [ :n |
str << ' ' << n ] ]
]

{ #category : #merging }
MpName >> merge: rhs [

Expand Down
10 changes: 1 addition & 9 deletions src/MyPeople/MpPerson.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -238,15 +238,7 @@ MpPerson >> nameDescription [

{ #category : #accessing }
MpPerson >> nameForAlphabetization [
^ String streamContents: [ :str |
self name lastName ifNotNil: [ :n |
str << n ].
str << ' '.
self name firstName ifNotNil: [ :n |
str << n ].
str << ' '.
self name middleName ifNotNil: [ :n |
str << n ] ]
^ self name lastNameFirst asUppercase copyWithout: $.
]

{ #category : #accessing }
Expand Down

0 comments on commit 2b55353

Please sign in to comment.