How to concatenate two strings in a GUI test?

  • Questions
  • How to concatenate two strings in a GUI test?
Question ID: 106553
0
0

I have two strings name sFirst and sLast which I need to put them together.

Marked as spam
Posted by (Questions: 45, Answers: 1)
Asked on December 29, 2015 2:22 pm
7 views
Answers (2)
0
Private answer

Try this:

sFirst = ''Tony''
sLast = ''None''
sName= sFirst & sLast
MsgBox sName

But you might want a space between the two strings and I would recommend:

sFirst = ''Tony''
sLast = ''None''
sName= sFirst & '' '' & sLast
MsgBox sName

Marked as spam
Posted by (Questions: 2, Answers: 98)
Answered on December 29, 2015 2:28 pm
0
Private answer

Additionally, in VBScript, you can also use the '+' as a concatenation operator.

Either of the following will work as valid concatenation operators in VBscript:

sName = sFirst & '' '' & sLast

or

sName = sFirst + '' '' + sLast

Marked as spam
Posted by (Questions: 2, Answers: 425)
Answered on December 30, 2015 5:46 pm