2013-06-05 45 views

回答

1

试试这个:

Dim strURLToEvaluate As String = "http://site.com/abgAz1nBs.jpg%20http://site.com/adtEh96Wj.jpg%20http://site.com/acum1N6qN.jpg" 

Dim strURLs As String() = Strings.Split(strURLToEvaluate, "%20http://") 

If strURLs.Length > 1 Then MsgBox("More than one URL!") 

For Each strURL In strURLs 
    If Strings.Left(strURL, Len("http://")) <> "http://" Then strURL = "http://" & strURL 
    MsgBox(strURL) 
Next strURL 
0

您可以使用下面的算法:

  • 检查字符串是否包含“%20http”(使用String.Contains)。
  • 如果是,则分割为“%20http”(使用String.Split)。
  • 在除第一个之外的每个拆分字符串(使用普通字符串连接)中添加“http”。

实施这些步骤应该很容易,并且将(故意)作为练习留给读者。实际上,在您正确实施它们之后,您可能会意识到您可以完全跳过第一步。