C#error:the name 'StringSplitOptions'does not exsit in the current context.

img


我想实现末尾有个“,”时不输出空字符,提示我stringsplitoptions在上下文不存在

需要引用命名空间,在脚本头部添加:`using System;`

按照29行这么写的话,若最后一个,后面没有值或者空格时就可以达到你要的效果了

 

 

将你的代码替换成以下代码即可

string [] zhuan = shur.text.Split(new char[]{','},System.StringSplitOptions.RemoveEmptyEntries);

你这个错误莫名其妙,你重新编译一下试试。