-1

我有这样的段落

我看到苏西坐在擦鞋店里。她坐在哪里发光,她坐在哪里发光。

所以我想删除多次出现的字符串。在上面的段落中,她,坐,在那里,闪耀的地方重复了不止一次。我想删除字符串需要这样的输出。

我看到苏西坐在擦鞋店里。她坐的地方闪闪发光,而且。

有没有人指导我解决这个问题?

4

1 回答 1

1

在不考虑标点符号的情况下,您可以尝试以下几行:

s1 = "I saw Susie sitting in a shoe shine shop. " _
   & "Where she sits she shines, and where she shines she sits."
a1 = Split(s1, " ")

For i = 0 To UBound(a1)
    For j = i + 1 To UBound(a1)
        If a1(j) = a1(i) Then
            a1(j) = ""
        End If
    Next

Next

s2 = Trim(Join(a1, " "))
于 2012-06-14T12:42:00.173 回答