您当前的位置: 首页 >  c#

Peter_Gao_

暂无认证

  • 1浏览

    0关注

    621博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

C# string split

Peter_Gao_ 发布时间:2022-02-10 15:35:23 ,浏览量:1


using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class StringSplit : MonoBehaviour
{

    void Start()
    {
        string str = "aaajbbbjccc";
        string[] sArray = str.Split('j');
        foreach (string i in sArray)
        {
            Debug.Log(i.ToString());
        }

        Debug.Log("++++++++++++++++++++++++++++++");

        string[] sArrayList = str.Split('-');
        foreach (string i in sArrayList)
        {
            Debug.Log(i.ToString());
        }
    }


}

        // 输出结果:

        aaa
        bbb
        ccc
        ++++++++++++++++++++++++++++++
        aaajbbbjccc

//注意:Split('j')是单引号

关注
打赏
1664521772
查看更多评论
立即登录/注册

微信扫码登录

0.0731s