From 0a67913b4854ab95758da135b86aef3ee9816e1e Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Mon, 9 Jun 2014 22:19:41 -0400 Subject: [PATCH] Dates - Fixed a loose, ill-defined, poorly constructed excuse for a detector of date ordinals ("1st, "22nd", "3rd" and "6th"). --- src/Dates.cpp | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/src/Dates.cpp b/src/Dates.cpp index 80e727a8e..15828861e 100644 --- a/src/Dates.cpp +++ b/src/Dates.cpp @@ -353,9 +353,26 @@ bool namedDates (const std::string& name, Variant& value) // 1st // 2nd // 3rd - else if (name.length () >= 3 && - name.length () <= 4 && - isdigit (name[0])) + // 4th + else if (( + name.length () == 3 && + isdigit (name[0]) && + ((name[1] == 's' && name[2] == 't') || + (name[1] == 'n' && name[2] == 'd') || + (name[1] == 'r' && name[2] == 'd') || + (name[1] == 't' && name[2] == 'h')) + ) + || + ( + name.length () == 4 && + isdigit (name[0]) && + isdigit (name[1]) && + ((name[2] == 's' && name[3] == 't') || + (name[2] == 'n' && name[3] == 'd') || + (name[2] == 'r' && name[3] == 'd') || + (name[2] == 't' && name[3] == 'h')) + ) + ) { int number; std::string ordinal;