亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

動(dòng)態(tài)向頁面添加控件和使用正則表達(dá)式的代碼

 更新時(shí)間:2009年08月13日 14:54:34   作者:  
動(dòng)態(tài)向頁面添加控件和使用正則表達(dá)式的實(shí)現(xiàn)代碼。
復(fù)制代碼 代碼如下:

namespace WebCode
{
public partial class _default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
String str = "這是一個(gè)測試文件<{config name=\"pagetitle1\"}>,一個(gè)標(biāo)簽的解析<{config name=\"pagetitle2\" count=\"2\"}>過程";
Label mylabel = new Label();
mylabel.ID = "display";
mylabel.Text = this.myReplace(str);
Page.Form.Controls.Add(mylabel);
}
protected String myReplace(String str)
{
String pattern = @"\<\{(.*?)\}\>";
Regex p = new Regex(pattern, RegexOptions.IgnoreCase);
MatchCollection m = p.Matches(str);
String matchs = "";
for (int i = 0; i < m.Count; i++)
{
matchs += "," + m[i];
}
return matchs.Substring(1);
}
}
}

Page.Form.Controls.Add
向頁面中Form節(jié)點(diǎn)的尾部添加控件。
using System.Text.RegularExpressions;
使用正則表達(dá)式要使用的類

相關(guān)文章

最新評(píng)論