From e6074874d0a069e076c126900a70aba95e6f45c2 Mon Sep 17 00:00:00 2001 From: Anton Sarukhanov <code@ant.sr> Date: Wed, 11 Dec 2019 22:05:25 -0500 Subject: [PATCH] Replace substrings more safely. --- whatformat/util/whatdateformat.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/whatformat/util/whatdateformat.py b/whatformat/util/whatdateformat.py index 0b39f32..c1c20cf 100644 --- a/whatformat/util/whatdateformat.py +++ b/whatformat/util/whatdateformat.py @@ -73,9 +73,9 @@ def _remove_extra_nlz(combinations) -> Iterator[List[str]]: for variant in combinations: is_duplicate = False for i, token in enumerate(variant): - if '-' in token: + if '%-' in token: with_zero = (variant[:i] + - (token.replace('-', ''),) + + (token.replace('%-', '%'),) + variant[(i + 1):]) if with_zero in combinations: is_duplicate = True -- GitLab