Here you can find the source of normalize(String adoc)
Parameter | Description |
---|---|
adoc | a parameter |
public static String normalize(String adoc)
//package com.java2s; //License from project: Open Source License import java.text.Normalizer; import java.util.Locale; import java.util.regex.Pattern; public class Main { static final Pattern NOT_PRINT = Pattern.compile( "([\\p{Punct}\\p{Cntrl}\\p{Sc}]|\\P{Print})+", Pattern.UNICODE_CHARACTER_CLASS); static final Pattern WHITESPACE = Pattern.compile("\\s+", Pattern.UNICODE_CHARACTER_CLASS); /**/* www.j a va 2s . c o m*/ * Normalize with Unicode aware. * @param adoc * @return */ public static String normalize(String adoc) { String normalized = Normalizer.normalize(adoc, Normalizer.Form.NFC); normalized = adoc.toLowerCase(Locale.ROOT); normalized = NOT_PRINT.matcher(adoc).replaceAll(" "); normalized = WHITESPACE.matcher(adoc).replaceAll(" "); normalized = normalized.trim(); return normalized; } }