Command to clean a string (or convert to ascii)

You are missing a feature or need an enhancement? Post your suggestion here!
Post Reply
fred48fm
Posts: 25
Joined: 28 Aug 2019 09:52

Command to clean a string (or convert to ascii)

Post by fred48fm » 08 Nov 2019 11:55

Hi,

Could it be possible to create a function to either convert a string to ascii or to make character replacing ?
Our RDS accept special characters but make some artistic interpretation.

For now I use this, but it's not very clean :

EXEC_VAR_SET rdsin|${cpltrackartistcurrent} ------ ${cpltracktitlecurrent}
EXEC_VAR_SET cleaner1|*[REPLACE:{${VAR:rdsin}}:{á}:{a}]
EXEC_VAR_SET cleaner2|*[REPLACE:{${VAR:cleaner1}}:{é}:{e}]
EXEC_VAR_SET cleaner3|*[REPLACE:{${VAR:cleaner2}}:{í}:{i}]
EXEC_VAR_SET cleaner4|*[REPLACE:{${VAR:cleaner3}}:{ó}:{o}]
EXEC_VAR_SET cleaner5|*[REPLACE:{${VAR:cleaner4}}:{ú}:{u}]
EXEC_VAR_SET cleaner6|*[REPLACE:{${VAR:cleaner5}}:{ý}:{y}]
EXEC_VAR_SET cleaner7|*[REPLACE:{${VAR:cleaner6}}:{à}:{a}]
EXEC_VAR_SET cleaner8|*[REPLACE:{${VAR:cleaner7}}:{è}:{e}]
EXEC_VAR_SET cleaner9|*[REPLACE:{${VAR:cleaner8}}:{ì}:{i}]
EXEC_VAR_SET cleaner10|*[REPLACE:{${VAR:cleaner9}}:{ò}:{o}]
EXEC_VAR_SET cleaner11|*[REPLACE:{${VAR:cleaner10}}:{ù}:{u}]
EXEC_VAR_SET cleaner12|*[REPLACE:{${VAR:cleaner11}}:{â}:{a}]
EXEC_VAR_SET cleaner13|*[REPLACE:{${VAR:cleaner12}}:{ê}:{e}]
EXEC_VAR_SET cleaner14|*[REPLACE:{${VAR:cleaner13}}:{î}:{i}]
EXEC_VAR_SET cleaner15|*[REPLACE:{${VAR:cleaner14}}:{ô}:{o}]
EXEC_VAR_SET cleaner16|*[REPLACE:{${VAR:cleaner15}}:{û}:{u}]
EXEC_VAR_SET cleaner17|*[REPLACE:{${VAR:cleaner16}}:{ã}:{a}]
EXEC_VAR_SET cleaner18|*[REPLACE:{${VAR:cleaner17}}:{õ}:{o}]
EXEC_VAR_SET cleaner19|*[REPLACE:{${VAR:cleaner18}}:{ñ}:{n}]
EXEC_VAR_SET cleaner20|*[REPLACE:{${VAR:cleaner19}}:{ç}:{c}]
EXEC_VAR_SET cleaner21|*[REPLACE:{${VAR:cleaner20}}:{ä}:{a}]
EXEC_VAR_SET cleaner22|*[REPLACE:{${VAR:cleaner21}}:{ë}:{e}]
EXEC_VAR_SET cleaner23|*[REPLACE:{${VAR:cleaner22}}:{ï}:{i}]
EXEC_VAR_SET cleaner24|*[REPLACE:{${VAR:cleaner23}}:{ö}:{o}]
EXEC_VAR_SET cleaner25|*[REPLACE:{${VAR:cleaner24}}:{ü}:{u}]
EXEC_VAR_SET cleaner26|*[REPLACE:{${VAR:cleaner25}}:{o̧}:{o}]
EXEC_VAR_SET rdsout|*[REPLACE:{${VAR:cleaner26}}:{ÿ}:{y}]

Thanks :-)

User avatar
radio42
Site Admin
Posts: 5574
Joined: 05 Apr 2012 16:26

Re: Command to clean a string (or convert to ascii)

Post by radio42 » 08 Nov 2019 12:49

You can use the *[STRING:{value}:{conv}:{p1}:{p2}] function macro to normalizes diacritic characters from a string, like this:

Code: Select all

*[STRING:{${cpltrackartistcurrent}}:{norm}:{0}:{0}]

fred48fm
Posts: 25
Joined: 28 Aug 2019 09:52

Re: Command to clean a string (or convert to ascii)

Post by fred48fm » 18 Nov 2019 14:02

That's perfect !

Thanks :-)

Post Reply

Who is online

Users browsing this forum: No registered users and 4 guests