rafalp
Novice

Replace polish characters in a string

Jump to solution

Hi,

I need to find a way to replace polish characters (diactric) in a string/text. I need to replace "ŻÓŁĆĘŚĄŹŃżółćęśąźń" to "ZOLCESAZNzolcesazn".

I know I can use Replace function (fn-Replace) however it repalce a section of text in a larger string but I need to replace character or characters in a string.

Does anyone know how to do it?

Rafał

0 Kudos
Reply
2 Replies
TomaszPoszytek

Re: Replace polish characters in a string

Jump to solution

Hi!

The idea that first came to my head is to create an UDA (User Defined Action, so that you can use it multiple times and manage in a single place), that has a DICTIONARY build from pairs: DIACRITIC CHAR: NON-DIACRITIC CHAR, ex.:

* ą:a

* Ą:A

* ć: c

* Ć: C

and so on...

Then make a for each loop, that will go through that dictionary and store both output and key in separate variables. In each loop use the "Regular Expression" action that will replace your current "key" (diacritic char) with a "value" (non-critic char). 

Regards,

Tomasz

0 Kudos
Reply
rafalp
Novice

Re: Replace polish characters in a string

Jump to solution

Hi,

Thank you Tomasz Poszytek‌ for the tip however I have user other solution. In fact the same one you have propsed in this post - Need to create an Organizational Unit object in AD using Nintex Workflow  

In this case I have used PowerShell action from Aaron Labiosa: NTX PowerShell Action - Stable Release

Below is PowerShell script that solved this problem:

function Change-DiactricChars ( [string]$text ) {
$text`
-replace( “ą”,”a” )`
-replace( “ć”,”c” )`
-replace( “ę”,”e” )`
-replace( „ł”,”l” )`
-replace( „ń”,”n” )`
-replace( „ó”,”o” )`
-replace( „ś”,”s” )`
-replace( „ż”,”z” )`
-replace( „ź”,”z” )`
-replace( „Ą”,”A” )`
-replace( „Ć”,”C” )`
-replace( „Ę”,”E” )`
-replace( „Ł”,”L” )`
-replace( „Ń”,”N” )`
-replace( „Ó”,”O” )`
-replace( „Ś”,”S” )`
-replace( „Ż”,”Z” )`
-replace( „Ź”,”Z” )
}
Change-DiactricChars("some regional DiactricChars here like ąęćę")

View solution in original post

0 Kudos
Reply