Strip away variations of n. Chr. from time strings for splitting

This commit is contained in:
Joshua Ramon Enslin 2020-09-20 15:52:02 +02:00 committed by Stefan Rohde-Enslin
parent affe8e3741
commit fd0bd48995

View File

@ -41,6 +41,15 @@ final class NodaTimeSplitter {
"12" => ['december', 'dec.'],
];
const STRINGS_TO_CLEAN = [
"között" => "",
"nach Christus" => "",
"n. Christus" => "",
"nach Chr." => "",
"n. Chr." => "",
"n.Chr." => "",
];
const STOP_STRINGS_GERMAN = [
"-",
",",
@ -104,7 +113,7 @@ final class NodaTimeSplitter {
while (strpos($input, " -") !== false) $input = str_replace(" -", "-", $input);
while (strpos($input, "- ") !== false) $input = str_replace("- ", "-", $input);
if (stripos($input, "között") !== false) $input = str_replace("között", " ", $input);
$input = strtr($input, self::STRINGS_TO_CLEAN);
return trim($input, ", [](){}");