mikakoistinen
7 years agoContributor
Script extension method parameter
Hi,
I tried to make my 1st script extension.
function cleanStr(s)
{
s = aqString.Replace(s, chr(27), '');
s = aqString.Replace(s,chr(2), '');
s = aqString.Replace(s,chr(28), '');
s = aqSt...
- 7 years ago
The error message is a bit misleading. The problem is not with the parameter, it's with your use of the chr method. That method is a method provided within the TestComplete environment and is not available within script extensions.
To do what you want to do, use the native JScript method String.fromCharCode like so
function cleanStr(s) { s = aqString.Replace(s, String.fromCharCode(27), ''); s = aqString.Replace(s,String.fromCharCode(2), ''); s = aqString.Replace(s,String.fromCharCode(28), ''); s = aqString.Replace(s,String.fromCharCode(14), ''); return s; }