Created
April 2, 2024 07:25
-
-
Save Georgy5/9e1306f4ae7cea61d1676e53cbe3d663 to your computer and use it in GitHub Desktop.
"Latinize" string normalization
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def latinize(string) | |
string.unicode_normalize(:nfd).chars.select do |char| | |
char.match(/\p{Latin}|\s/) | |
end.join | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment