2013-06-05 44 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」。

實施這些步驟應該很容易,並且將(故意)作爲練習留給讀者。實際上,在您正確實施它們之後,您可能會意識到您可以完全跳過第一步。