Deleting a specific sequence of characters (linebreaks?) from astring

A

Aldric Giacomoni

I need to delete a sequence of characters like '\\n' from a string - but I don't want to delete every 'n' and every '\' from it! So .. "delete" doesn't seem to be an option and I can't get "gsub" to do what I want. Is there a tried and true solution that I just haven't found? Here is an example test, straight from the document itself:

Soft linebreaks are linebreaks preceeded by '\\' like this one >o\
k<. Hard line breaks are all other linebreaks.
Soft linebreaks are converted to >nothing<, i.e. removed.

Note that linebreaks are coded differently on different systems.

Examples (>ok< shouldn't be split):

linebreak 1 "\\n": >o\
k<
linebreak 2 "\\n\\r": >o\

k<
linebreak 3 "\\r\\n": >o\
k<
linebreak 4 "\\r": >o\
k<]


Expected result is that >ok< looks normal on all lines - I don't know how to make that happen. Can anyone enlighten me .. Or put me on the path?

Thanks,
--Aldric
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,048
Latest member
verona

Latest Threads

Top