I am always trying to build a text from UFT GUI data table and was wondering how can I add newline?
Answer by bubblehead712 · Dec 31, 2015 at 05:00 PM
Concatenation of the two strings with the newline character
To concatenate two strings with the newline character, use vbNewLine or "chr(10)".
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).
Answer by Jafar · Jan 05, 2016 at 05:01 PM
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
final_var1 = variable1 + vbNewLine + variable2