return Regex.Replace(strInput, keyword,
"<span class='highlight'>$0</span>", RegexOptions.IgnoreCase);
var Data = [{"key": "key5", "value": "value5"}, {"key": "key4", "value": "value4"}, {"key": "key3", "value": "value3"}];
var html = [];
html.push('<select name="test">');
for (var i = 0; i < Data.length; i++) {
html.push('<option value="' + Data[i]["key"] + '">',
Data[i]["value"],
"</option>");
}
html.push('</select>');
return html.join('');
List<string> listOfString = new List<string>();
for (int i = 0; i < 10; i++)
{
listOfString.Add(i.ToString());
}
string strResult = string.Join(", ", listOfString.ToArray());
<head id="Head1" runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="~/Admin/AdminMenu.css" type="text/css" rel="stylesheet" />
<head id="Head1"><meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="../AdminMenu.css" type="text/css" rel="stylesheet" />
$.ajax({
cache: false,
data: "fun=SetAsBestAnswer&aid=" + articleId + "&rid=" + replyId,
dataType: "json",
success: function (objData, strTextStatus) {
...........
Encoding enc = Encoding.UTF8; XmlWriterSettings xws = new XmlWriterSettings(); xws.Encoding = enc; xws.Indent = true; MemoryStream ms = new MemoryStream(); string strXml = ""; using (XmlWriter writer = XmlWriter.Create(ms, xws)) { writer.WriteStartDocument(); writer.WriteStartElement("rss"); writer.WriteAttributeString("version", "2.0"); writer.WriteStartElement("channel"); // channel data writer.WriteElementString("title", "最新文章"); ...(XML 資料)...... writer.WriteEndElement(); // channel end writer.WriteEndElement(); //rss end writer.WriteEndDocument(); writer.Flush(); StreamReader reader = new StreamReader(ms, enc, true); ms.Seek(0, SeekOrigin.Begin); strXml = reader.ReadToEnd(); }
<p>
<div>content1</div>
<div>content2</div>
<div>content3</div>
</p>
瀏覽器會解讀成
<p></p>
<div>content1</div>
<div>content2</div>
<div>content3</div>
<p></p>