0

i have the following paragraph:

Free Daily Horoscope by findyourfate.comhttp://www.findyourfate.comThings are good and getting better -- and you need to learn how to accept this fact. While this may sound like flippant or sarcastic advice, the truth is that lately, whenever the fates have thrown a few rose petals in your path, you have chosen to see them as just more debris -- if you have elected to see them at all. Wake up and wise up. You need to start acknowledging the gifts as gifts meant for you. You need to understand just how worthy of them you are.http://www.findyourfate.com/rss/dailyhoroscope-feed.asp?sign=Aries [return delivery report]

which I stored in a string using vb.net.

How can I split that string to output only the following part:

Things are good and getting better -- and you need to learn how to accept this fact. While this may sound like flippant or sarcastic advice, the truth is that lately, whenever the fates have thrown a few rose petals in your path, you have chosen to see them as just more debris -- if you have elected to see them at all. Wake up and wise up. You need to start acknowledging the gifts as gifts meant for you. You need to understand just how worthy of them you are.

4

1 回答 1

0

如果您有相同的段落,并且每次需要获得相同的输出时,您可以使用 replace 而不是 split 它更容易:

 Dim texts As String = "Free Daily Horoscope by findyourfate.comhttp://www.findyourfate.comThings are good and getting better -- and you need to learn how to accept this fact. While this may sound like flippant or sarcastic advice, the truth is that lately, whenever the fates have thrown a few rose petals in your path, you have chosen to see them as just more debris -- if you have elected to see them at all. Wake up and wise up. You need to start acknowledging the gifts as gifts meant for you. You need to understand just how worthy of them you are.http://www.findyourfate.com/rss/dailyhoroscope-feed.asp?sign=Aries [return delivery report]"

    texts = texts.Replace("Free Daily Horoscope by findyourfate.comhttp://www.findyourfate.com", "")

    texts = texts.Replace("http://www.findyourfate.com/rss/dailyhoroscope-feed.asp?sign=Aries [return delivery report]", "")

你会得到同样的结果,当然,如果你总是

如果您想使用拆分:

Dim arraytext() As String

    arraytext = Split(texts, "Free Daily Horoscope by findyourfate.comhttp://www.findyourfate.com")

    arraytext = Split(arraytext(1), "http://www.findyourfate.com/rss/dailyhoroscope-feed.asp?sign=Aries [return delivery report]")

MsgBox(arraytext(0))
于 2013-11-08T09:05:57.533 回答