Hi,
My string is - " Año" and “Presentación” or “Joe$”
I want to remove ~ , ’ and $ from string in robot framework. There may be any uni code or special char in string and I want to remove all those chars from string.
Hi,
My string is - " Año" and “Presentación” or “Joe$”
I want to remove ~ , ’ and $ from string in robot framework. There may be any uni code or special char in string and I want to remove all those chars from string.
Hi @bk-user
The Unidecode module looks like it will do most of what you want to achieve:
*** Settings ***
Test Template Convert Unicode Word
*** Test Cases ***
ñ Año
ó Presentación
$ Joe$
3 kožušček
*** Keywords ***
Convert Unicode Word
[Arguments] ${originalword}
${newword}= Evaluate unidecode.unidecode("${originalword}") unidecode
Log ${newword}
It didn’t do the $ sign but did the others, so depending how many other cases there are you could use a series of Replace String’s to handle the remaining few something like:
*** Settings ***
Library String
Test Template Convert Unicode Word
*** Test Cases ***
ñ Año
ó Presentación
$ Joe$
3 kožušček
@ $p3c!@l
*** Keywords ***
Convert Unicode Word
[Arguments] ${originalword}
${newword}= Evaluate unidecode.unidecode("${originalword}") unidecode
${newword}= Replace String ${newword} ! i
${newword}= Replace String ${newword} @ a
${newword}= Replace String ${newword} $ s
${newword}= Replace String ${newword} 3 e
Log ${newword}
Hopefully that’s what you need,
Dave.
@damies13 Getting Error -
FAIL Evaluating expression ‘unidecode.unidecode(“kožušček”)’ failed: ModuleNotFoundError: No module named ‘unidecode’
Library String
Above library is imported but still getting error