OpenOffice Writer 宏从字符串中删除撇号

OpenOffice Writer macro remove apostrophe from String

我正在 OpenOffice Writer 中编写宏。

我从 .xml 文件中读取文本并将其放入字符串中。 字符串将如下所示: "hello"(所以撇号也是字符串的一部分)

为了清楚起见,字符串看起来像这样(示例): String removeApostrophe = ""hello"".

我知道这很奇怪,但它是这样写在 .xml 文件中的。

我需要的是一个函数,我可以在其中放入该字符串并删除撇号,这样只会:你好会出来。

我试过但不可能的是替换函数:Replace(" "hello" ", """ , "")

函数调用:

removeApostrophe = replace(removeApostrophe, chr(34), "")

这是使用的函数:

Function Replace(removeApostrophe As String, Search As String, NewPart As String)
  Dim Result As String
  Dim StartPosition As Long
  Dim CurrentPosition As Long

  Result = ""
  StartPosition = 1
  CurrentPosition = 1

  If Search = "" Then
    Result = removeApostrophe
  Else 
Do While CurrentPosition <> 0
  CurrentPosition = InStr(StartPosition, removeApostrophe, Search)
  If CurrentPosition <> 0 Then
    Result = Result + Mid(removeApostrophe, StartPosition, _
    CurrentPosition - StartPosition)
    Result = Result + NewPart
    StartPosition = CurrentPosition + Len(Search)
  Else
    Result = Result + Mid(removeApostrophe, StartPosition, Len(removeApostrophe))
  End If                ' Position <> 0
Loop 
 End If 

  Replace = Result
End Function

首先我使用了:char(34),但是没有用。所以我发现 chr(34) 是正确的选择。