C# string.Split对于换行符的分隔正确用法

tmpCase
"11117144-8c91-4817-9b92-99ec2f9d784a\r\n23D95A26-012C-4332-8FE0-05B2B4279DC4\r\nA27127CA-B9C4-4090-B274-015972600AB1\r\n38DF94E9-0391-44D7-9A30-07AA963E5E5C"
tmpCase.Split(new string[]{"\\r\\n"},StringSplitOptions.RemoveEmptyEntries)
{string[1]}
    [0]: "11117144-8c91-4817-9b92-99ec2f9d784a\r\n23D95A26-012C-4332-8FE0-05B2B4279DC4\r\nA27127CA-B9C4-4090-B274-015972600AB1\r\n38DF94E9-0391-44D7-9A30-07AA963E5E5C"
tmpCase.Split(new string[]{@"\r\n"},StringSplitOptions.RemoveEmptyEntries)
{string[1]}
    [0]: "11117144-8c91-4817-9b92-99ec2f9d784a\r\n23D95A26-012C-4332-8FE0-05B2B4279DC4\r\nA27127CA-B9C4-4090-B274-015972600AB1\r\n38DF94E9-0391-44D7-9A30-07AA963E5E5C"
tmpCase.Split(new char[]{'\r','\n'},StringSplitOptions.RemoveEmptyEntries)
{string[4]}
    [0]: "11117144-8c91-4817-9b92-99ec2f9d784a"
    [1]: "23D95A26-012C-4332-8FE0-05B2B4279DC4"
    [2]: "A27127CA-B9C4-4090-B274-015972600AB1"
    [3]: "38DF94E9-0391-44D7-9A30-07AA963E5E5C"

posted on 2016-01-20 18:52  Mack.Meng  阅读(4091)  评论(0编辑  收藏  举报