Micro Focus QTP (UFT) Forums
Concatenation operator in Vbscript - Printable Version

+- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums)
+-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP)
+--- Forum: VB Scripting/Descriptive Programming (https://www.learnqtp.com/forums/Forum-VB-Scripting-Descriptive-Programming)
+--- Thread: Concatenation operator in Vbscript (/Thread-Concatenation-operator-in-Vbscript)



Concatenation operator in Vbscript - sk.aravind - 12-20-2009

Hi ppl,
I am using descriptive programming to click a record from my database. since there are no unique properties i tried to hard code the value

say my html id is xyz_0_1 where 0 & 1 indicates row and column respectively.. i need to store "xyz_" in a variable and dynamically change "0_1" .how do i do it

i stored xyz in a variable a

and then 0_1 in another variable b. i concatenated both by mentioning as a & b
but the msgbox displays the a&b and not the values stored in it.Where have i gone wrong.pls correct me


RE: Concatenation operator in Vbscript - Ankur - 12-21-2009

Please write your code here.


RE: Concatenation operator in Vbscript - sk.aravind - 12-21-2009

a="xyz"
b=_1

c= a & b

msgbox c

msgbox displays a&b instead of the values. i know that i have gone wrong in the third step while concatenating.pls correct me

sorry abt the duplicate thread


RE: Concatenation operator in Vbscript - Saket - 12-21-2009

not sure how are you getting such result, checkout your code properly.
you should use, either use b = 1 or b = "_1", instead b = _1


RE: Concatenation operator in Vbscript - QTPLearn - 09-08-2010

Hi
Correct Approach is below:

Code:
a="xyz"
b="_1"
c= a & b

msgbox c

~Regards


RE: Concatenation operator in Vbscript - lotos - 09-13-2010

Hi all,
I have an approximately same issue, the idea is that I am getting a value from DB which is assigned to a variable, e.g. Requested_Field.
the format of this value is e.g.: 126991.55 (it have an ".")
then to the second variable is assigned another value, which is got from the application, it's value is for e.g. the same but format is another: 126,991.55 (with "," and ".").
when I am comparing them, I'm getting an error, this is because the formats are different: the report added by me when comparison fails is:
The variable1: '126991.55' is not the same as variable2: '126,991.55'! Please check manually!

Can anyone help me to remove the "," from first variable, I don't know which statement should be used to remove some specific chars(the chars I want) from a string or a variable..
Please can anyone help me?


RE: Concatenation operator in Vbscript - jsknight1969 - 09-13-2010

You could use a double instead of string, but if you want to use strings and must remove the comma....

Code:
a1 = "123,456.78"
a1 = replace(a1,",","") 'replaces the comma with a blank

Just in case you were wondering about the double method
Code:
a1 = cdbl("123,454.56")



RE: Concatenation operator in Vbscript - lotos - 09-14-2010

Thanks a lot man, I found it and it's working.