Possible Duplicate:
replace " in vb.net
How to put data containing double-quotes in string variable? Aug 01, 2003 02:30 AM | LINK
I need to store a string that contains words in double quotes. The complete string data is presented to the variable in double quotes, but the next double quotes within the data ends the string and the remaining text gives a syntax error. How can I place literal double-quotes in a string variable? For example:
Dim MyVar as string = "stm_bm(["menu53d0",400,"","blank2.gif",0,"","",0,0,250,0,1000,1,0,0,""],this);"
To place quotation marks in a string in your code In Visual Basic, insert two quotation marks in a row as an embedded quotation mark. In Visual C# and Visual C++, insert the escape sequence \" as an embedded quotation mark.
To remove double quotes just from the beginning and end of the String, we can use a more specific regular expression: String result = input. replaceAll("^\"|\"$", ""); After executing this example, occurrences of double quotes at the beginning or at end of the String will be replaced by empty strings.
You can concatenate double quotes in java by using the addition + operator. This operator is used for performing addition of numbers and concatenation of strings.
You can escape (this is how this principle is called) the double quotes by prefixing them with another double quote. You can put them in a string as follows:
Dim MyVar as string = "some text ""hello"" hello"
This will give the MyVar
variable a value of some text "hello" hello
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With