加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

c# – 如何使用两个连续空格分割字符串

发布时间:2020-12-15 18:29:11 所属栏目:百科 来源:网络整理
导读:我有一个由连续空格组成的字符串 a(double space)b c d (Double space) e f g h (double space) i 分裂像 ab c de f g hi 目前我正在尝试这样 Regex r = new Regex(" +"); string[] splitString = r.Split(strt); 解决方法 你可以使用 String.Split : var i
我有一个由连续空格组成的字符串
a(double space)b c d (Double space) e f g h (double space) i

分裂像

a
b c d
e f g h
i

目前我正在尝试这样

Regex r = new Regex(" +");
        string[] splitString = r.Split(strt);

解决方法

你可以使用 String.Split
var items = theString.Split(new[] {"  "},StringSplitOptions.None);

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读