Thread Rating:
  • 1 Vote(s) - 1 Average
  • 1
  • 2
  • 3
  • 4
  • 5
how can I store a string with variable in it, in another variable?
#1
Solved: 10 Years, 8 Months, 3 Weeks ago
Hi All,

I have a string like this

Code:
<A href="manage_contact_edit.htm?contactId=newstr>Edit</A>

where newstr is a variable

I want to store the above string in a variable like this

Code:
str = "<A href="manage_contact_edit.htm?contactId=newstr>Edit</A>"

Its giving me an error "Expected End of Statement"

can anybody tell me how to store the above string in a variable?

Thanks in advance.

Regards,
Reema.
Reply
#2
Solved: 10 Years, 8 Months, 3 Weeks ago Wink 
Hi Reema,

The error is occurring as the number of double quotes is odd in the given statement.

Code:
str = "<A href="manage_contact_edit.htm?contactId=newstr>Edit</A>"


You may try this:

Code:
str = "<A href='manage_contact_edit.htm?contactId=" + newstr + "'>Edit</A>"

Please let me know if still any problem.

Smile
Reply
#3
Solved: 10 Years, 8 Months, 3 Weeks ago
Hi Saini,

The problem is that I want that quotes to be there.

Just one more thing to add to this

how can I write this statement

Do Until (s(i) = " " ")
Loop

The problem is " here.... I want to compare S(i) with "

How can I write this?

Thanks
Reema.
Reply
#4
Solved: 10 Years, 8 Months, 3 Weeks ago
Hi Reema,

Work around Smile

Strore <A href="manage_contact_edit.htm?contactId=newstr>Edit</A> in datatable and fetch it from there
Code:
str = DataTable.Value("A",1)
msgbox str

Thanks,

Rajeshwar
Reply
#5
Solved: 10 Years, 8 Months, 3 Weeks ago
Work around Smile

try:
Code:
str = "<A href=" & chr(34) & "manage_contact_edit.htm?contactId=newstr>Edit</A>"

Here I am using the ASCII code of double quote, 34.

Try:
MsgBox str

To see the value of str
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Inserting variable values into Descriptive Programming Functions eske99 2 3,140 12-18-2015, 01:47 PM
Last Post: vinod123
  Can you please help me in QTP DP to pass the variable name anshika.agarwal 1 2,590 09-04-2014, 06:43 PM
Last Post: anshika.agarwal
  Assigning object properties to a variable using dp nmakkena 1 3,743 04-18-2014, 06:46 AM
Last Post: kgovadav
  variable is undefined: wscript shipu 1 4,357 01-09-2014, 07:23 AM
Last Post: basanth27
  How to retrieve ArrayList saved in Environment Variable Gautam26 8 4,435 11-07-2013, 08:26 PM
Last Post: ssvali

Forum Jump:


Users browsing this thread: 1 Guest(s)