※ 引述《colorsea (OH Yes! Babe~)》之銘言:
: 噗~才剛po完問題,就爬到文了^^"
: 感謝1782篇,ithinkurdumb大大的貢獻....
: 問題已解決,附上原始碼,給有需要的人參考~~~^^
: string txt = txtPatn.Text.ToString();
: Int32 int1 = txt.IndexOf("[");
: Int32 int2 = txt.IndexOf("]");
: if(int1 != -1 && int2 != -1)
: {
: txt = txt.Remove(int1 + 1, int2-int1-1);
: txt = txt.Insert(int1 + 1, btn.Text.ToString());
: txtPatn.Text = txt;
: }
private void button4_Click(object sender, EventArgs e)
{
txtPatn.Text = Regex.Replace(txtPatn.Text, @"\[(\w+)\]", "[answer]");
}
--
http://blog.roodo.com/chhuang
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 61.62.84.89