Commit d8a360f6 by Jan Hrabal

strip accents

parent ccaa3e2f
......@@ -2,6 +2,7 @@ package com.jh.boot.utils;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.text.Normalizer;
import java.util.Objects;
import org.springframework.util.StringUtils;
......@@ -260,5 +261,13 @@ public class Utils {
return nullsFirst && c1 == null ? -1 : 1;
}
public static String normalize(String s) {
if (s == null) {
return null;
}
s = Normalizer.normalize(s, Normalizer.Form.NFD);
s = s.replaceAll("[\\p{InCombiningDiacriticalMarks}]", "");
return s.toLowerCase();
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment