normalize method

String normalize(
  1. NormalizationSettings settings
)

Normalizes a string following the given normalization settings.

Implementation

String normalize(NormalizationSettings settings) {
  String normalized = this;

  // Normalizes the case type, but keep the case (upper or lower)
  if (settings.normalizeCaseType) {
    normalized = normalized.normalizeCaseType();
  }

  // Lowercases the string.
  if (settings.normalizeCase) {
    normalized = normalized.toLowerCase();
  }

  // Removes the diacritics.
  if (settings.removeDiacritics) {
    normalized = normalized.removeDiacritics();
  }

  return normalized;
}