Define : Type special chars in WinRuneer?

Define : Type special chars in WinRuneer?

Type special chars as they are, instead of interpreting them : 

> Data can be read from a data file and then typed into an app.

> Escape the following chars: <> - +.

> In a string, quote \" and backslash  will already be escaped.

> Generally won\'t be a lot of special chars, so.

> Use index instead of looping through each character.

> Function no_special data .

{

auto esc_data, i, p;

esc_data = \"\";

while(1)

{

p=32000;

i=index(data,\"-\");

p=i?(i<p?i:p):p;

i=index(data,\"+\");

p=i?(i<p?i:p):p;

i=index(data,\"<\");

p=i?(i<p?i:p):p;

i=index(data,\">\");

p=i?(i<p?i:p):p;

if (p<32000)

{

esc_data = esc_data substr(data,1,p-1) \"\\\" substr(data,p,1);

data = substr(data,p+1);

}

else break;

}

esc_data = esc_data data;

return esc_data;

}

> trial run here

data = \"This -- is +the+ <yobbo> new test sample\";

win_activate(\"Untitled - Notepad\");

win_type(\"Untitled - Notepad\", no_special(data));


By:UMANG
Date:2002-02-09 00:00:00

Post Your Answers


User Email:

User Name:
Answers:

Related TESTING Subjective Links

TESTING Subjective interview questions and answers for experienced and fresher