Adding Quotes to a string (")

Hi I have a code

(1)  Results = Browser("Technology Portal - Home").Page("Google Search").WebElement("results").GetROProperty("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
anju_a_sagarAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

solomonacquahCommented:
enclose result with  chr(34)
0
hieloCommented:
s_prop24="s.prop24=""" & Results & """
0
anju_a_sagarAuthor Commented:
hi hielo,

syntax error: unterminated string constant
0
Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

hieloCommented:
there's a missing " at the end of that line. Try:

s_prop24="s.prop24=""" & Results & """"
0
anju_a_sagarAuthor Commented:
the result is

s.prop24=""50,800,000""

i want

s.prop24="50,800,000"
0
solomonacquahCommented:
Try

s_prop24="s.prop24=chr(34) & Results & chr(34)
0
anju_a_sagarAuthor Commented:
hi,

syntax error: unterminated string constant
0
solomonacquahCommented:
could you paste the code?
0
anju_a_sagarAuthor Commented:
I have explained in my question...thats the only code

0
Mike TomlinsonMiddle School Assistant TeacherCommented:
solomonacquah was very close...

Try:

    s_prop24 = "s.prop24=" & Chr(34) & Results & Chr(34)
0
solomonacquahCommented:
Are you sure you are putting 4 sets of double quotes?
0
anju_a_sagarAuthor Commented:
its coming up with

s.prop24=""50,800,000""
0
Mike TomlinsonMiddle School Assistant TeacherCommented:
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?
0
hieloCommented:
>>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:
<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 

Open in new window

0
anju_a_sagarAuthor Commented:
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
0
Mike TomlinsonMiddle School Assistant TeacherCommented:
I've never used QTP.  ...so you are viewing the value inside some kind of IDE?  This may be the root of the problem as it may be displaying it differently than it is actually represented internally.

How about you display the value FROM WITHIN the Script using a MsgBox?

Something like:

    s_prop24 = "s.prop24=" & Chr(34) & Results & Chr(34)
    WScript.Echo s_prop24

Does it display differently?
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
anju_a_sagarAuthor Commented:
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
0
anju_a_sagarAuthor Commented:
yes u r right..in the msgbox its showing me the right value..
thanks for the help
i got it..
0
anju_a_sagarAuthor Commented:
thanks a lot
0
Mike TomlinsonMiddle School Assistant TeacherCommented:
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....  =)
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
VB Script

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.