我正在尝试使用两个分隔符将字符串转换为string [],并且我希望分隔符在结果字符串[]节点中为空字符串
string source = "(('CO.IN'.bit = C) OR ('CO.IN'.bit = V))";
char[] delimiters = new char[] { '(', ')' };
string[] parts = source.Split(delimiters,StringSplitOptions.None);
Run Code Online (Sandbox Code Playgroud)
string []部分的预期结果是:
[null]
[null]
'CO.IN'.bit = C
[null]
' OR '
[null]
'CO.IN'.bit = V
[null]
[null]
Run Code Online (Sandbox Code Playgroud)
但结果是:
[null]
[null]
'CO.IN'.bit = C
' OR '
'CO.IN'.bit = V
[null]
[null]
Run Code Online (Sandbox Code Playgroud)
我想念两个节点,我不明白为什么.
有人可以帮我吗?