java.lang.Object
org.tentackle.common.DefaultStringNormalizer
- All Implemented Interfaces:
StringNormalizer
@Service(StringNormalizer.class)
public class DefaultStringNormalizer
extends Object
implements StringNormalizer
The default normalizer (works sufficiently for most western languages).
- Author:
- harald
-
Constructor Summary
ConstructorsConstructorDescriptionCreates normalizer.
With a comma as the field separator and space as word separator.DefaultStringNormalizer(char fieldSeparator, char wordSeparator) Creates a normalizer. -
Method Summary
Modifier and TypeMethodDescriptionNormalizes a string (phonetically) for use as PDO.normText.Converts special unicode characters (so-called diacrits) to standard ascii.
Supports also special german and northern european "umlauts".
-
Constructor Details
-
DefaultStringNormalizer
public DefaultStringNormalizer(char fieldSeparator, char wordSeparator) Creates a normalizer.- Parameters:
fieldSeparator- separator between text fields, 0 if nonewordSeparator- separator between words during reduction
-
DefaultStringNormalizer
public DefaultStringNormalizer()Creates normalizer.
With a comma as the field separator and space as word separator.
-
-
Method Details
-
unDiacrit
Description copied from interface:StringNormalizerConverts special unicode characters (so-called diacrits) to standard ascii.
Supports also special german and northern european "umlauts".- Specified by:
unDiacritin interfaceStringNormalizer- Parameters:
str- the string to be convertedkeepLength- true if the length should be kept, i.e. no Ä to AE, but to A- Returns:
- the converted string
-
normalize
Normalizes a string (phonetically) for use as PDO.normText.- Specified by:
normalizein interfaceStringNormalizer- Parameters:
str- the string to be normalized- Returns:
- the normalized string
-