第一种情况:
地址栏地址:http://news.xinhuanet.com/travel/2008-11/26/content_10413635.htm
内容中的图片地址:xinsrc_142110526092025008551.jpg第二种情况:
地址栏地址:http://news.xinhuanet.com/travel/2008-11/26/content_10413635.htm
内容中的图片地址:../../xinsrc_142110526092025008551.jpg第三种情况: 
地址栏地址:http://news.xinhuanet.com/travel/2008-11/26/content_10413635.htm
内容中的图片地址:/xinsrc_142110526092025008551.jpg如何将内容中的图片地址转换成  
http://news.xinhuanet.com/travel/2008-11/26/xinsrc_142110526092025008551.jpg
http://news.xinhuanet.com/travel/xinsrc_142110526092025008551.jpg
http://news.xinhuanet.com/xinsrc_142110526092025008551.jpg在我已经得到地址栏中的地址与所有图片地址的情况下如何进行转换? 第一种情况于第三种情况已知道处理方法,唯独第二种不是很了解,请问朋友们有没有什么方法,请赐教

解决方案 »

  1.   

    这个还不简单,把抓回来的图片址用if进行判断三
    假定你抓回的图片地址把存在string picAddress中string pic;
    if(picAddress == "xinsrc_142110526092025008551.jpg")
      pic = "http://news.xinhuanet.com/" + picAddress;
    if(picAddress == "../../xinsrc_142110526092025008551.jpg")
      pic = "http://news.xinhuanet.com/travel/2008-11/26/"+picAddress;
    if(picAddress == "/xinsrc_142110526092025008551.jpg")
      pic = "http://news.xinhuanet.com/travel/"+picAddress;