Answer by bubblehead712 · Dec 31, 2015 at 05:03 PM
Including a double quote inside of the string
To include a double quote within a string stored in a variable, use the Chr function to define the character in the string.
charcode The ANSI number that identifies a character.
For a double quote character, the ANSI number is 34. Refer to the ANSI character chart for additional characters.
str = Chr(34) & "hello world" & Chr(34) msgbox str str = "My " & chr(34) & " String" MsgBox str
Answer by Jafar · Jan 05, 2016 at 04:41 PM
You can also use an escape character to allow the double quote as well.
UFT uses VBScript.
Strings in VBScript are represented by enclosing the string inside starting and ending double quotes as shown below
str = "hello world"
But to represent “hello world” (including the quotes) the below code won’t work due to a syntax error:
str = ""hello world"" MsgBox str
The issue with above code is that first pair of double quotes mark the end of the string and anything after that causes a syntax error. We need an escape character which will allow us to escape the double quote within the string. Unlike C, C++, JAVA etc… the escape character in VBScript is not \ but the double quote. So to represent “hello world” as string we will use:
str = """hello world""" MsgBox str
The first and and last quotes mark the start and end of string. Every continuous pair of double quotes inside a string is treated a 1 double quote
Dealing with character limit on a field 2 Answers