diff options
Diffstat (limited to 'src/main/scala/reading/models/Book.scala')
-rw-r--r-- | src/main/scala/reading/models/Book.scala | 16 |
1 files changed, 2 insertions, 14 deletions
diff --git a/src/main/scala/reading/models/Book.scala b/src/main/scala/reading/models/Book.scala index 34af272..7d72f23 100644 --- a/src/main/scala/reading/models/Book.scala +++ b/src/main/scala/reading/models/Book.scala @@ -11,20 +11,8 @@ case class Book( programs: Seq[Program], level: Level ) extends Ordered[Book] { - def compare(that: Book) = { - def formatTitle(title: String) = - title - .toLowerCase - .replaceAll("^les ", "") - .replaceAll("^le ", "") - .replaceAll("^l’", "") - .replaceAll("^à la ", "") - .replaceAll("^au ", "") - .replaceAll("^aux ", "") - .replaceAll("é", "e") - .replaceAll("è", "e") - formatTitle(this.title).compare(formatTitle(that.title)) - } + def compare(that: Book) = + Compare.format(this.title).compare(Compare.format(that.title)) } object Book { |