http://www.Google.com 
//获取Googlehttp://forum.csdn.net/PointForum/Forum/PostTopic.aspx?forumID=e27912-79d52833-9c57-8723107a
//获取csdnhttp://xxx.abcd.com/
//获取abcd
有正则最好.谢谢!

解决方案 »

  1.   


                string[] str = test.Split('.');
                str[0]; //你要的结果
      

  2.   

    wuyq11 谢谢你的回答有点小问题,
    比如是:http://xxx.abcd.com/
    用这个正则获取的是xxx.
      

  3.   


    谢谢mggstrong的回答.
    不过这样写不是太严谨,还是用正则好一些.我在研究下.
      

  4.   

    下面的预期结果是什么?
    http://topic.csdn.test.net/
    http://topic.csdn.net/
    http://topic.csdn.com.cn
      

  5.   


    谢谢你的回答.不过不能用哦
    比如 http://www.google.com
    返回 www.google.
      

  6.   

    算了.太着急.
    把mggstrong的先改一下,顶上去再说
    string tempWebDomain = dal.GetWebDomain(tempWebID);
    string[] tempArray = tempWebDomain.Split('.');
    return tempArray[1];