Skip to content

Commit 57e68f6

Browse files
committed
Author's first & last name: capitalize the first letter
Signed-off-by: Pekka Helenius <[email protected]>
1 parent 73960c2 commit 57e68f6

File tree

1 file changed

+4
-2
lines changed
  • bookstore/src/main/java/com/fjordtek/bookstore/model

1 file changed

+4
-2
lines changed

bookstore/src/main/java/com/fjordtek/bookstore/model/Author.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,8 @@ public void setFirstName(String firstName) {
124124
if (firstName.isEmpty()) {
125125
this.firstName = null;
126126
} else {
127-
this.firstName = firstName;
127+
// Capitalize the first letter
128+
this.firstName = firstName.substring(0,1).toUpperCase() + firstName.substring(1);
128129
}
129130
}
130131

@@ -136,7 +137,8 @@ public void setLastName(String lastName) {
136137
if (lastName.isEmpty()) {
137138
this.lastName = null;
138139
} else {
139-
this.lastName = lastName;
140+
// Capitalize the first letter
141+
this.lastName = lastName.substring(0,1).toUpperCase() + lastName.substring(1);
140142
}
141143
}
142144

0 commit comments

Comments
 (0)