如何拆分asp.net? [英] How to split in asp.net?

查看:73
本文介绍了如何拆分asp.net?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

  private   const   string  SEPARATOR =    - ; 

string temp = COM + SEPARATOR + 计算机





我想拆分临时基地SEPARATOR,我有这样的代码但不行,



 string szRet = temp.Split(new char [] {SEPARATOR})[0]; 





你能帮帮我吗? div class =h2_lin>解决方案

示例代码:

  string  source =   COM  -  Computer; 
string [] stringSeparators = new string [] { - };
var result = source.Split(stringSeparators,StringSplitOptions.None);

// 输出:
// result [0] =COM
// result [1] =Computer






试试这个。



http://www.dotnetperls.com/split [ ^

private const string SEPARATOR = " - ";

string temp = "COM" + SEPARATOR + "Computer"



I want to split temp base SEPARATOR, i have code like this but not work,

string szRet = temp.Split(new char[] {SEPARATOR})[0];



Can you help me?

解决方案

Sample code :

string source = "COM - Computer";
string[] stringSeparators = new string[] { " - " };
var result = source.Split(stringSeparators, StringSplitOptions.None);

//Output :
//result[0] = "COM"
//result[1] = "Computer"


Hi,

try this.

http://www.dotnetperls.com/split[^]


这篇关于如何拆分asp.net?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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