看板 C_Sharp 關於我們 聯絡資訊
有字串 "this is a test" 我想變為 "this is a test" 我嘗試用 split 把字串的空白去掉再 join 起來 不過如果有連兩個空格, split 會把他split成空字串 這並不是我預期的..=.= 請問要怎麼做比較好呢? -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 140.129.160.67
michaelz:regular expression 03/31 16:14
saitoh:str.Split(' ', StringSplitOptions.RemoveEmptyEntries); 03/31 16:16
huggie:謝謝 saitoh !! 03/31 16:35
EricTsai:原來Split有這個overload啊 XD 03/31 17:05
senjor:一樓:那有Lex或Flex可以用嗎 XD... 04/01 08:33