Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
" " in search text
#1
Not Solved
Hi,

I have text something like this :
Code:
<td width="33" background="/images/main_nav_bg.gif"><img src="/images/gnav_div.gif" width="2" height="11" vspace="6" hspace="14" />
I need to store this text and verify it against actual value.
Now when I try to save this in a variable
say txt = above string,I get error message (expected end of statement) as there are many " " characters in the string itself and in QTP by default if we use " " then it is considered as comment.
can someone please help me how can I store one big sentence in a variable that contains " " within it.
Reply
#2
Not Solved
Are you sure you have to verify ALL the above tags?

if yes you can extract them from their respective GetRoProperties
Want to fast track your QTP/UFT Learning? Join our UFT Training Course
Reply
#3
Not Solved
Yes,unfortunately I have to store all these variables.
This is working by placing " infront of each ", means like this (width=""2"").
Now the problem I am facing is retrieving them back to normal means(width = "2").
I tried using Replace(Var,"""",""") but this is not working.
Any other ideas?

What I am trying to do is above text is all static so I need to store static content ,add some values and then verify it against dynamic values displayed.Any help is appreciated.
Reply
#4
Not Solved
Hi,
Using Replace(Var,"""",""") will not work as ' " ' is a metacharacter. Hence try converting ' " ' to ASCII value (i think the ASCII value of " is 34 and use Chr(34))

Code:
vReplace = Chr(34) & Chr(34)
vValue = Replace(Var,vReplace,Chr(34))

*this code may require some chage.
Reply
#5
Not Solved
Hi Manojith,

I tried using the above code, tried with some modifications as well using chr(39) too, but did not work.Thanks in adavance for your help.

Code:
sString1 = "height=""1"
vReplace = Chr(34) & Chr(34)
vValue = Replace(sString1,vReplace,Chr(34)).
Reply
#6
Not Solved
Hi there,

try to escape double quotes by using double quote.
Code:
a= "<td width=""33"" background=""/images/main_nav_bg.gif""><img src=""/images/gnav_div.gif"" width=""2"" height=""11"" vspace=""6"" hspace=""14"" />"

msgbox a
Reply
#7
Not Solved
Hi Prafulla,

Please see my above question.
I am trying to remove the extra double that I entered.
Reply
#8
Not Solved
Hi...

i think u want that 33 in double quote...i.e."33" for that u need to treat " as special char..rt..n for tht u hv to use it like ""33""...
plz let me know if its clear
Reply
#9
Not Solved
Prafulla,

It is the oppsoite of what you understood I guess.

I have a long string(for now I am using an exSmile
Code:
String1 = "height=""11"
In this case I want output as below with escape characters removed.Hope it is clear.
Code:
String1 = "height="11"
Reply
#10
Not Solved
supose u have a string say String1 = "height=""11" and u want String1 as "height="11" .If thi is the case then use the below code

Code:
String1 = "height=""11"
str = replace(String1,chr(34)&chr(34),chr(34))
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  How to record google search items venkatasuresh06 0 2,767 03-09-2011, 06:31 AM
Last Post: venkatasuresh06
  BACK GROUND COLOUR OF A PARTICULAR AREA IN A SEARCH WINDOW remya 2 2,936 11-25-2010, 06:11 PM
Last Post: KavitaPriyaCR

Forum Jump:


Users browsing this thread: 1 Guest(s)