From 57e68f6e79f2853e2449fa6a7e8ce26f15da1034 Mon Sep 17 00:00:00 2001 From: Pekka Helenius Date: Wed, 30 Sep 2020 19:25:41 +0300 Subject: [PATCH] Author's first & last name: capitalize the first letter Signed-off-by: Pekka Helenius --- .../src/main/java/com/fjordtek/bookstore/model/Author.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/bookstore/src/main/java/com/fjordtek/bookstore/model/Author.java b/bookstore/src/main/java/com/fjordtek/bookstore/model/Author.java index 13cf360..ec7ad3a 100644 --- a/bookstore/src/main/java/com/fjordtek/bookstore/model/Author.java +++ b/bookstore/src/main/java/com/fjordtek/bookstore/model/Author.java @@ -124,7 +124,8 @@ public class Author { if (firstName.isEmpty()) { this.firstName = null; } else { - this.firstName = firstName; + // Capitalize the first letter + this.firstName = firstName.substring(0,1).toUpperCase() + firstName.substring(1); } } @@ -136,7 +137,8 @@ public class Author { if (lastName.isEmpty()) { this.lastName = null; } else { - this.lastName = lastName; + // Capitalize the first letter + this.lastName = lastName.substring(0,1).toUpperCase() + lastName.substring(1); } }