I would like to delete a specific string from a document. I manage to delete the content of the string, but the line break still remains after. I found some things about ControlCharacters but it seems they are only numeric constants. Is it actually useful?
This works.
r = oDoc.createReplaceDescriptor()
r.setSearchString("FOOBAR")
r.setReplaceString("OTHERSTUFF")
oDoc.replaceAll(r)
This does not
r = oDoc.createReplaceDescriptor()
r.setSearchString("FOOBAR\n")
r.setReplaceString("OTHERSTUFF")
oDoc.replaceAll(r)
r = oDoc.createReplaceDescriptor()
r.setSearchString("FOOBAR\r")
r.setReplaceString("OTHERSTUFF")
oDoc.replaceAll(r)
How do I delete the whole line, including the line break?
According to the built in help:
I interpret this to mean that newline characters cannot be searched for. Instead, loop through the search results and delete the character. Here is some code that does this: