string a = "adfowfl;saeefjwo20fsf;safj20fsdf;"
string b;
for(int i = 0 ; i < a.Length ; i++)
{
if(i % 3)
    b = a[i].ToString();
else
    b += a[i].ToString();
}

解决方案 »

  1.   

    从此实例检索子字符串。子字符串从指定的字符位置开始且具有指定的长度。
    String myString = "abc";
    bool test1 = String.Compare(myString.Substring(2, 1), "c") == 0; // This is true.
    myString.Substring(3, 1); // This throws ArgumentOutOfRangeException.
    bool test2 = String.Compare(myString.Substring(3, 0), String.Empty) == 0; // This is true.
      

  2.   

    string s="很长很长的字符串.....................................";int i=s.Length;
    ArrayList ar=new ArrayList;for(int j=0,j<i;j=j+3)
    {
        string str=SubString(s,j,3);
        ar.Add(str);
    }
      

  3.   

    using System;public class test
    {
    static void Main()
    {
    string s ="abcdefghijkmno"; for(int i=0;i<s.Length ;i+=3 )
    {
    if(i<s.Length-3)
    Console.WriteLine(s.Substring(i,3));
    else
    Console.WriteLine(s.Substring(i));
    }
    }
    }
      

  4.   

    using System;public class test
    {
    static void Main()
    {
    string s ="abcdefghijkmno"; for(int i=0;i<s.Length ;i+=3 )
    {
    if(i<s.Length-3)
    Console.WriteLine(s.Substring(i,3));
    else
    Console.WriteLine(s.Substring(i));
    }
    }
    }