为特定符号子串我的C#字符串? [英] Substring my C# string for specific symbol ?

查看:76
本文介绍了为特定符号子串我的C#字符串?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好



请我尝试在c中剪切我的字符串#



我的字符串是ASP- CCNA-Oracle



string Mytext =ASP-CCNA-Oracle;



所以我需要输出如



字符串A =ASP;

字符串B =CCNA;

string C =Oracle;



如何使用c#代码执行此操作?

解决方案

  string  Mytext =   ASP-CCNA -Oracle; 
string [] items = MyText.Split(' - ');
string A = items [ 0 ];
string B = items [ 1 ];
string C = items [ 2 ];


Hello

please I try to cut my string in c#

my string is ASP-CCNA-Oracle

string Mytext ="ASP-CCNA-Oracle";

so I need the output like

string A ="ASP";
string B = "CCNA";
string C="Oracle";

how can I do that using c# code ?

解决方案

string Mytext ="ASP-CCNA-Oracle";
string[] items = MyText.Split('-');
string A = items[0];
string B = items[1];
string C = items[2];


这篇关于为特定符号子串我的C#字符串?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆