C# 字串分割
以前用PHP要分割字串,通常都是用split,不管是幾個字元串都可以分割,但用C#就不一樣了
你可以用String.Split('@'),但你就是不能用String.Split("@"),想當然而,你想用String.Split("@@")同樣也不行,這對我來說還蠻困擾的。
後來上網找了一下次料,發現這篇文章,實測用於自己的程式中,確實可正確分解出來,所以,在這做一下筆記,以免日後忘記!
string sStr = "a@@b@@c";
string[] saStr = sStr.Split(new string[] { "@@" }, StringSplitOptions.RemoveEmptyEntries);
//則string[] saStr的內容為 a、b、c
2016-07-28 20:25:15
Label 在 PictureBox 上背景不能透明 | 2021-05-24 06:32 |
Textbox限制輸入數字 | 2016-11-14 21:17 |
LINQ筆記 | 2016-07-27 03:33 |
SQL Server的記錄檔無限成長 | 2015-11-02 05:47 |
安裝MySQL ODBC 5.2錯誤 – Error 1918 | 2014-02-03 19:27 |
在Reporting Service報表上顯示QRCode | 2013-04-01 02:59 |
SQL Server DB管理筆記 | 2012-07-05 20:21 |
還原MSSQL遇到「備份組包含現有的XXX資料庫以外的資料庫備份」的錯誤 | 2012-05-15 12:35 |
Informix計算兩時間的差距 | 2010-08-12 06:01 |
ReportViewer顯示LocalReport及ServerReport | 2010-05-24 04:13 |
SQL Server取得當月第一天及最後一天 | 2010-01-19 00:00 |
簡單的對DataTable做Distinct | 2009-09-20 22:18 |
使用 svcutil 編譯 WCF 錯誤解法 | 2009-07-09 07:59 |
PHP加載MSSQL函式庫 | 2008-10-20 08:54 |
資料庫抓取固定筆數資料 | 2008-09-18 22:27 |