How to remove diacritics (umlauts) from a string?

How to convert a string, for example Příliš žluťoučký kůň úpěl ďábelské ódy.to Prilis zlutoucky kun upel dabelske ody.?

The source string is in Unicode, so in principle it should be possible to use normalization / decomposition to separate the umlaut.

Unfortunately, I did not see any library in Pharo (maybe zinc is hidden somewhere?) That would support either cleansing umlauts or decomposition.

+4
source share
2 answers

You can try the Diacriticals package

Installation

Metacello new
    smalltalkhubUser: 'Pharo' project: 'MetaRepoForPharo50';
    configuration: 'Diacritics';
    version: #development;
    load.

Test

'Příliš žluťoučký kůň úpěl ďábelské ódy' asNonDiacritical.
 "'Prilis zlutoucky kun upel dabelske ody'"
+4
source

, , , , , , , Smalltalk. , , VM, libicu. , . . ICU .

+2

Source: https://habr.com/ru/post/1649929/


All Articles