简体   繁体   中英

how to perform string concatenation in vb.net?

This is string value <a href="javascript:changePage('5')">Overview</a> .Now i want to store it in a string in vb.net.

How do i store it.

Dim link As String="<a href="javascript:changePage('5')">Overview</a>"

Please guide me to get out of this issue?

You need to escape the inner " by doubling them:

Dim link As String="<a href=""javascript:changePage('5')"">Overview</a>"

The C# version can be one of:

var link = @"<a href=""javascript:changePage('5')"">Overview</a>"

var link = "<a href=\"javascript:changePage('5')\">Overview</a>"

Just use single quotes within the literal denoted by double quotes. Doing this with markup that will be output to the browser will result in invalid markup for single quotes within quotes - in that case you can escape the double quotes with another 'set' of double quotes.

Dim link As String = "<a href=""javascript:changePage('5')"">Overview</a>"

I have been out of VB.NET for a long time, in C-Sharp it can be done like:

String link = "<a href=\"javascript:changePage('5')\">Overview</a>";

I hope it will give you an idea, you will have to escape the inner double quotes.

用途如下:

Dim link As String = "<a href=\"javascript:changePage('5')\">Overview</a>"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM