From 053b987d58383a5bc6e68ff4c1477cf59ced87e0 Mon Sep 17 00:00:00 2001 From: Al Date: Mon, 27 Jul 2015 01:59:14 -0400 Subject: [PATCH] [normalize] adding an option for string trimming in normalize --- src/normalize.c | 4 ++++ src/normalize.h | 1 + 2 files changed, 5 insertions(+) diff --git a/src/normalize.c b/src/normalize.c index 4d6b5a68..190e3859 100644 --- a/src/normalize.c +++ b/src/normalize.c @@ -11,6 +11,10 @@ char *normalize_string_utf8(char *str, uint64_t options) { bool have_utf8proc_options = false; + if (options & NORMALIZE_STRING_TRIM) { + string_trim(str); + } + if (options & NORMALIZE_STRING_DECOMPOSE) { have_utf8proc_options = true; utf8proc_options |= UTF8PROC_OPTIONS_NFD; diff --git a/src/normalize.h b/src/normalize.h index 098f283b..3d6f2783 100644 --- a/src/normalize.h +++ b/src/normalize.h @@ -44,6 +44,7 @@ extern "C" { #define NORMALIZE_STRING_STRIP_ACCENTS 1 << 2 #define NORMALIZE_STRING_DECOMPOSE 1 << 3 #define NORMALIZE_STRING_LOWERCASE 1 << 4 +#define NORMALIZE_STRING_TRIM 1 << 5 #define NORMALIZE_TOKEN_REPLACE_HYPHENS 1 << 0 #define NORMALIZE_TOKEN_DELETE_HYPHENS 1 << 1