Skip to content

Conversation

@jockrlos685
Copy link

Converts a string with accented characters (diacritics) into their standard equivalent version (ASCII); eg. José > Jose
Includes additional methods such as:

  • Removing special characters keeping alphanumeric only, eg. O'brian > Obrian
  • Replacing special characters with empty spaces, eg. O'brian > O brian
  • Returning using proper case (first letter capitalised), eg. joe doe > Joe Doe
  • Removing all spaces
    More info in the ReadMe field

…racters (diacritics) into their standard equivalent version (ASCII)
Copy link
Collaborator

@ericrsmith35 ericrsmith35 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will create a post for unofficialsf based on your Readme. I'll add the link to this PR when ready. I would appreciate any additions you could suggest for the writeup. I will also repackage this and update the install links.

@jockrlos685
Copy link
Author

jockrlos685 commented Jun 27, 2025

Brilliant, @ericrsmith35, thanks for taking this on.

For the write-up, perhaps we can embed some short YouTube videos I just made:

String Normaliser Name Demo
<iframe width="560" height="315" src="https://www.youtube.com/embed/QFNgFggoskw?si=GC6mBvCRSyDf-x2v" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe>

String Normaliser cleaning a corrupted string Demo
[<iframe width="560" height="315" src="https://www.youtube.com/embed/QFNgFggoskw?si=sQv983tH_PtudDd5" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe>](https://youtu.be/ETszzSCV9SE)

Additional text for the write-up:

Components in this package

StringNormaliser Utility Class

This utility class performs different string normalisations actions that can be combined within each other. Its methods can be called anywhere in Apex, such as Trigger or a Batchable class to clean Contact's Name in bulk for existing records, for example.

Includes the following methods:

  • removeDiacritics(String): replaces accented characters by the ASCII version using a hardcoded map. This class can be extended to use Custom Metadata records to define additional characters replacement - (scheduled for a next release)
  • convertToProperCase(String): Capitalises the first letter of every word, similar to the PROPER() function in Excel.
  • removeSpecialCharacters(String): Completely removes any characters that is not an alphanumeric value.
  • replaceSpecialCharactersForSpace(String): Instead of completely removing the non-alphanumeric character, it replaces them for a empty spaces, O'Brian > O Brian
  • removeAllWhiteSpaces(String): removes all empty space from string, for cases where a string needs to be compare with another string.

StringNormaliser Invocable Action

Apex Action to use in Flows to normalise x2 strings (eg. First Name and Last Name).

Inputs:

  • "String 1" - Text
  • "String 2" - Text
  • "Apply Proper Case" - Boolean: Capitalises the first letter of every word, similar to the PROPER() function in Excel.
  • "Remove special characters" - Boolean: Completely removes any characters that is not an alphanumeric value.
  • "Replace special characters for a space" - Boolean: Instead of completely removing the non-alphanumeric character, it replaces them for a empty spaces, O'Brian > O Brian
  • "Remove spaces" - Boolean: removes all empty space from string, for cases where a string needs to be compare with another string.

Outputs:

  • Normalised String 1.
  • Normalised String 2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants