How to concatenate two strings with the newline character UFT GUI?
Question ID: 106562
0
0

I am always trying to build a text from UFT GUI data table and was wondering how can I add newline?

Marked as spam
Posted by (Questions: 45, Answers: 1)
Asked on December 31, 2015 4:59 pm
2223 views
Answers (2)
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:

final_var1 = variable1 & vbNewLine & variable2
or

final_var1 = variable1 + vbNewLine + variable2

Marked as spam
Posted by (Questions: 3, Answers: 168)
Answered on January 5, 2016 5:01 pm
0
This is not recommend because if you have mix variable types (String and Int) VB Script with throw Type Mistype error in UFT.
( at January 5, 2016 5:23 pm)
0
Private answer

Concatenation of the two strings with the newline character
To concatenate two strings with the newline character, use vbNewLine or ''chr(10)''.
Example:

variable1 = ''This is line1''
variable2 = ''This is line2''
final_var1 = variable1 & vbNewLine & variable2
final_var2 = variable1 & chr(10) & variable2
msgbox(final_var1)
msgbox(final_var2)

For additional string formatting characters, refer to the ''String Constants'' section in the VBScript reference (QuickTest Professional Help -> Microsoft Windows Script Technologies -> Windows Script Technologies -> VBScript -> Reference -> Constants -> String Constants).

Marked as spam
Posted by (Questions: 2, Answers: 98)
Answered on December 31, 2015 5:00 pm
EyeOnTesting

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

X
Scroll to Top