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
92 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: 477)
Answered on December 30, 2015 5:46 pm
EyeOnTesting

Welcome back to "EyeOnTesting" brought to you by Orasi Software, Inc.

X
Scroll to Top