In my QTP script I have a word in notepad that ends in a
question mark, for example... "father?" As part of my
script I want to delete the question mark. How do you
delete a character in notepad?

Answers were Sorted based on User's Feedback



In my QTP script I have a word in notepad that ends in a question mark, for example... "fathe..

Answer / satya

U can do it with SFO script[I am not sure of Syntax or
exact code,just approach I m Mentioning Below]-
Set oObj=createObject("Script.FyleSystemObject")
oFile=oObj.openTextFile("YourPath")
Do Until EndOfSream
oStr=oObj.readLine
if InStr(oStr,"?")>0 Then
RePlace(oSter,"?","")
Loop

Is This Answer Correct ?    3 Yes 2 No

In my QTP script I have a word in notepad that ends in a question mark, for example... "fathe..

Answer / lak

Const ForReading = 1
'Save notepad file in D: Drive and type Father? then save

Const ForReading = 1
Const ForWriting = 2
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile("D:\Find.txt", ForReading)

strText = objFile.ReadAll
objFile.Close
strNewText = Replace(strText, "?", "")

Set objFile = objFSO.OpenTextFile("D:\Find.txt", ForWriting)
objFile.WriteLine strNewText

objFile.Close

Is This Answer Correct ?    1 Yes 0 No

In my QTP script I have a word in notepad that ends in a question mark, for example... "fathe..

Answer / saff

i am asuming there is only one "father?"
string in file
open the desired notepad
and them search for the desired string byusing instr
v = instr(filename,searchstring)'the position of the string
father
b=instr(filename,"?") 'the position of the ?
n =b-n ' will give the size of the string

now use the replace function to replace the ? with whatever
uw want

it will show the position of first occurance of the stirng

Is This Answer Correct ?    0 Yes 0 No

In my QTP script I have a word in notepad that ends in a question mark, for example... "fathe..

Answer / ratikanta

Word="father?"
Set Fso=Createobject("scripting.filesystemobject")
Set Fs=Fso.opentextfie("path")
X=Fs.Readline
mydata=split(X," ")
If mydata=word Then
str=Replace(mydata,"?","")
EndIf
msgbox str

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More QTP Interview Questions

In QTP, If you have list of checkboxes, how can i select a particular checkbox and delete if the checkboxes are changing dynamically?

0 Answers  


If I give some thousand tests to execute in two days what do you do?

0 Answers  


what QTP Options do you know?

0 Answers  


In an interview, what r the general questions asked in QTP? pls give me anwser to this question?

0 Answers  


How to maintain the old scripts in QTP?

2 Answers   Olive Tech, Wipro,






Using Regular expression method some particular value is not present in given value. HOow do use regular expression? Forexample password all number,character ,special character are accepted but (_',)underscore,comma are not used. How do write regular expression.

1 Answers  


What is Automation frame work.How we will prepare in real time.

9 Answers   AppLabs,


what are the metrics in general we use in testing.

6 Answers   TCS,


What do you do if QTP doesn't recognize object ,what action should be taken

11 Answers   Lehman Brothers,


what you mean by artifact,milestone...

0 Answers  


How cookies can be tested in QTP?

2 Answers   Deloitte, TCS,


write a script to close all open browser in qtp except one browser whose name is xyz

6 Answers   Cap Gemini,


Categories