anju_a_sagar
asked on
Adding Quotes to a string (")
Hi I have a code
(1) Results = Browser("Technology Portal - Home").Page("Google Search").WebElement("resul ts").GetRO Property(" innerhtml" )
---in Results variable- the value is 5800000
(2) s_prop24="s.prop24="
-- in s_prop24 variable- the value is s.prop24=
the final result i want s.prop24="5800000"
Can you please help how can concatenate and add quotes?
thanks
anju
(1) Results = Browser("Technology Portal - Home").Page("Google Search").WebElement("resul
---in Results variable- the value is 5800000
(2) s_prop24="s.prop24="
-- in s_prop24 variable- the value is s.prop24=
the final result i want s.prop24="5800000"
Can you please help how can concatenate and add quotes?
thanks
anju
enclose result with chr(34)
s_prop24="s.prop24=""" & Results & """
ASKER
hi hielo,
syntax error: unterminated string constant
syntax error: unterminated string constant
there's a missing " at the end of that line. Try:
s_prop24="s.prop24=""" & Results & """"
s_prop24="s.prop24=""" & Results & """"
ASKER
the result is
s.prop24=""50,800,000""
i want
s.prop24="50,800,000"
s.prop24=""50,800,000""
i want
s.prop24="50,800,000"
Try
s_prop24="s.prop24=chr(34) & Results & chr(34)
s_prop24="s.prop24=chr(34)
ASKER
hi,
syntax error: unterminated string constant
syntax error: unterminated string constant
could you paste the code?
ASKER
I have explained in my question...thats the only code
solomonacquah was very close...
Try:
s_prop24 = "s.prop24=" & Chr(34) & Results & Chr(34)
Try:
s_prop24 = "s.prop24=" & Chr(34) & Results & Chr(34)
Are you sure you are putting 4 sets of double quotes?
ASKER
its coming up with
s.prop24=""50,800,000""
s.prop24=""50,800,000""
WHERE and HOW are you displaying your resulting string?...and are you sure that the value in Results doesn't already have quotes around it?
>>the result is
>>s.prop24=""50,800,000""
You originally said
"---in Results variable- the value is 5800000"
If that is true, then what I posted above (ID:24871542) will give you:
s.prop24="50800000"
See example below:
>>s.prop24=""50,800,000""
You originally said
"---in Results variable- the value is 5800000"
If that is true, then what I posted above (ID:24871542) will give you:
s.prop24="50800000"
See example below:
<script type="text/vbscript">
Dim Results,s_prop24
Results=5800000
s_prop24="s.prop24=""" & Results & """"
alert(s_prop24)
</script>
However, it sounds like Results does NOT equal 5800000. It sounds like
Results equals "5800000" (with the quotes).
If that is the case, then you need to use:
s_prop24="s.prop24=" & Results
ASKER
i am using QTP tetsing tool and when i run the script i have made a check point where i can see the value of variable.
I m sure there is no quotations in Results variable value
I m sure there is no quotations in Results variable value
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Please see the screenshot attached.
The actual values are shown below in the variables.
but even though its shown with double quotes..its not stored with double quotes
screenshot.doc
The actual values are shown below in the variables.
but even though its shown with double quotes..its not stored with double quotes
screenshot.doc
ASKER
yes u r right..in the msgbox its showing me the right value..
thanks for the help
i got it..
thanks for the help
i got it..
ASKER
thanks a lot
EXACTLY...so the QTP Environment is adding the quotes around the value because it is a String variable. The quotes are not there internally and they are only being placed there for display purposes in the test environment.... =)