private void button2_Click(object sender, EventArgs e) { Regex reg = new Regex(@"/[([/+|-]?/d+(?:./d*)?),([/+|-]?/d+(?:./d*)?)/]"); string text = "[+1.2,-3.4][5.67,+34.23][-12.365,8888]"; MatchCollection mc = reg.Matches(text); foreach (Match match in mc) { if (match.Groups.Count != 3) return; double a = Convert.ToDouble(match.Groups[1].Value); double b = Convert.ToDouble(match.Groups[2].Value); Console.WriteLine("{0},{1}",a,b ); } }
http://www.rubular.com/
強烈推薦這個正則表達式在線測試工具,用起來特別方便
1. Abort() 會給調用他的線程拋出ThreadAbortException異常,該異常使得線程終止。他也能被用戶的代碼捕獲,但是被捕獲後又會自動重新拋出以便終止線程。 2. Abort()通常不能立即終止一個線程,因此,如果需要在