replace - OpenOffice Writer macro remove apostrophe from String -
i writing macro in openoffice writer.
i read text .xml file , put string. string this: "hello" (so apostrophe part of string)
so clear string looks this(example): string removeapostrophe = ""hello"".
i know weird it's written in .xml file way.
what need function can put string in , removes apostrophe only: hello come out.
something tried not possible replace function: replace(" "hello" ", """, "")
function call:
removeapostrophe = replace(removeapostrophe, chr(34), "")
this function used:
function replace(removeapostrophe string, search string, newpart string) dim result string dim startposition long dim currentposition long result = "" startposition = 1 currentposition = 1 if search = "" result = removeapostrophe else while currentposition <> 0 currentposition = instr(startposition, removeapostrophe, search) if currentposition <> 0 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
first used: char(34), doesn't work. found out chr(34) right thing use.
Comments
Post a Comment