拆分成 数组
每项都ToString("000")

解决方案 »

  1.   

    string Strip = "192.1.1.6";
    string [] ArrayStrip = Strip .split('.',4);
    string Result;
    for(int i=0;i<4;i++)
    {
    Result += ArrayStrip [i].PadLeft(20, '0');
    }
      

  2.   

    错了:string Strip = "192.1.1.6";
    string [] ArrayStrip = Strip .split('.',4);
    string Result;
    for(int i=0;i<4;i++)
    {
       Result += ArrayStrip [i].PadLeft(3, '0');
    }
      

  3.   

    用String.Split 方法拆分
    eg:
    string words = "192.1.1.66"
    string [] split = null;
    for (int x = 1; x <= 4; x++) {
        split = words.Split(".", x);
    }
    自己试试吧
      

  4.   

    谢谢Mycro(咕咕咕咕)大哥,那我在把这个IP地址插入到表中去,是不是只要插入字符串Result呀?