Hi there,
I'm trying to code a routine which will deal with the extra return characters in text which is copy/pasted from an email. Email programs usually hard-wrap text at about 80 characters. I can assume that a single return which is not followed by whitespace or another return is a hardwrap that should be removed, so that in this text:
This is
a paragraph.
This is a
second paragraph.
This is a third paragraph.
The first and third linebreaks can be removed.
This is easy to do with plain text, but I'm not sure how to approach it in the context of a TRichViewEdit, since each line will be a "paragraph"; I guess what I need to do is to find any paragraph which:
-is not empty
-does not start with whitespace, and
-is not preceded by an empty paragraph
and then "merge" it with the preceding paragraph. Has anyone done anything like this before with TRichViewEdit, and if so, can you suggest an approach?
All help appreciated,
Martin
Stripping unwanted returns
-
- Site Admin
- Posts: 17559
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
I hope these code samples will be useful for you
http://www.trichview.com/forums/viewtop ... =6701#6701
http://www.trichview.com/forums/viewtop ... =6701#6701
-
- Posts: 131
- Joined: Mon Aug 29, 2005 12:03 pm
-
- Posts: 131
- Joined: Mon Aug 29, 2005 12:03 pm
None of those functions does exactly what I need to do, so I have to write my own based on them. To do that, I need to understand a couple of undocumented things. Could you help with these?
SaveAsPrev
rvbpFullWidth
In my case, the linebreaks I want to remove are those which are not preceded by an empty line, and do not start with whitespace (indicating a paragraph indent). In other words:
This line break should
be removed.
However, the preceding ones shouldn't.
And the one at the beginning of this line shouldn't.
Cheers,
Martin
SaveAsPrev
rvbpFullWidth
In my case, the linebreaks I want to remove are those which are not preceded by an empty line, and do not start with whitespace (indicating a paragraph indent). In other words:
This line break should
be removed.
However, the preceding ones shouldn't.
And the one at the beginning of this line shouldn't.
Cheers,
Martin
-
- Site Admin
- Posts: 17559
- Joined: Sat Aug 27, 2005 10:28 am
- Contact: