StrShihe="2,3,4,5,7,8,9...";
string[] str=StrShihe.Split(','); 我想只截取5个 2,3,4,5,7, 只截取5个 请教高手 我该如何做 ,不想写循环 有没有方法直接可以截取的本人菜鸟 感谢大家~~~
string[] str=StrShihe.Split(','); 我想只截取5个 2,3,4,5,7, 只截取5个 请教高手 我该如何做 ,不想写循环 有没有方法直接可以截取的本人菜鸟 感谢大家~~~
Console.WriteLine( StrShihe.Substring(0,9));
chinese wholesalers
ugg
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.OleDb;
using System.Data;namespace ConsoleApplication8
{
class Program
{
static void Main(string[] args)
{ string StrShihe = "2,3,4,5,7,8,9,12,12,12";
IEnumerable<string> str = StrShihe.Split(',').Take(5);
foreach (string s in str)
{
Console.WriteLine(s);
}
}
}
}
SubString规定字符串的长度是9了,现在不确定字符串数 该如何做呢?