You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

strings.web.ts 652B

1234567891011121314151617181920
  1. /**
  2. * Applies NFKC normalization to the given text.
  3. *
  4. * @param {string} text - The text that needs to be normalized.
  5. * @returns {string} - The normalized text.
  6. */
  7. export function normalizeNFKC(text: string) {
  8. return text.normalize('NFKC');
  9. }
  10. /**
  11. * Replaces accent characters with english alphabet characters.
  12. * NOTE: Here we use the unorm package because the JSC version in React Native for Android crashes.
  13. *
  14. * @param {string} text - The text that needs to be normalized.
  15. * @returns {string} - The normalized text.
  16. */
  17. export function normalizeAccents(text: string) {
  18. return text.normalize('NFD').replace(/[\u0300-\u036f]/g, '');
  19. }