Você está na página 1de 8

Highlights

When you need to rearrange a text list you might be faced with borrowing operations.
The TextTrimmer program may help you addressing two cases: Block operations and Mass
operations. Think, for instance if you should do:
I) actions that are easy with a table but not with a text, because must be repeated
vertically on more rows, as:
- cancelling on each of those rows the same segment of characters (i.e.: from the xth
position to the yth position of the row);
- moving or copying on a row a segment of characters from one position to a
di&erent one and repeat the same on more rows vertically;
- moving or copying as before but from a group of rows to a di&erent one;
II) full erasing o keeping of rows, related to particular contents that may appear
elsewhere in those rows;
III) whole cleaning of a particular content, maintaining the rest of each row;
IV) sorting all rows.
A )rst example illustrating the Block operations. Here we have just a piece of rough list
representing rows of an html )le coming, in some way, from an Internet site.

It contains the addresses of images and we want to extract only those segments. Using
the TextTrimmer we can trace a rectangle (a Block) including the unwanted parts existing
on the left and cancel all inside it:

and then we can trace another Block to repeat the same action on the right:

so, at the end we obtain what we want:

This is a simple case, because the Blocks dont need to stay at the beginning or at the end
of the rows, but they can be traced anywhere, and embracing not all but only some of the
text rows.
More quickly: we should have drawn our block just on the wanted text and trim all outside,
with only one action.

A second example illustrating the Mass operations. Here we have just a rough list
representing rows coming in some way from an Internet site that talks about philosophers
(only a small piece of a long list is shown), and we want to extract only the philosophers
names.

Using TextTrimmer we can with one command discard all the rows starting with <, then,
with a second command, clear the cues with </a on the right of the philosophers names.
And with some other quick command we will meet the expected result:

Details
Block Mode
Open your text )le and it will be shown in Block Mode (bisque background).
In Block Mode the program disables the typical text-editing operations and handles the
page as a large table with one column for each character.
There you can do the followings:
Alt + left mouse click: to select a character: it appears in pale blue and represents the
)rst corner of the Block you are going to select;

a second Alt + left mouse click: to select the second (opposite) corner and the whole
Block will be coloured and automatically copied in the program internal clipboard

At this point the program enables three actions (the buttons


corresponding menu items):
Trim text: that blanks the characters contained in the Block;

or the

Trim positions: that erases those table cells, left shifting the external right portions
of the corresponding rows;

Trim outside: that erases all what exists out of your Block and realigns it to the left
top of the page.

Instead, if you are interested in Copy or Move operations you must do:
a third Alt + left mouse click: to chose the left top character of the target destination
Block (if you make a mistake, you can correct repeating Alt + left mouse click in a
di&erent position);

The choose of the third corner disables the operations seen above and enables four new
ones
:
Copy over: that copies the selected Block and looses the existing characters on the
destinations;

Copy and shift right: that maintains the existing characters shifting their row
segments to the right;

Move over: that does as the corresponding Copy operation but erasing the original
Block;

Move and shift right: that does as the corresponding Copy operation but erasing the
original Block.

At any time, if you want to abort the operation or start a new one, you can:
Un-mark all the current selections with the ESC key or button

or cancel or resume the last operations (the last four are handled) with

UnDo or ReDo.
List Mode
Clicking on
(or the corresponding menu item) the program passes to the alternative
mode.
When in List Mode (white background) you can act quite as in a usual Notepad
environment.
Instead of the ways for selecting, copying, moving, undoing/redoing earlier illustrated for
Block Mode, you have here to use: simple and double click, Ctrl + the standard accelerators
C, X, V, Z and Y.
Block Mode & List Mode common functions
There are two common functions

Sort: that arranges all the rows in ascending order (A to Z only);


Trim by Rules: that opens a dialog box for selecting each time a rule for clearing,
splitting, cancelling, and keeping rows.

In details:
- Trim leading blanks (ending blanks is automatic and cannot be changed);
- Split the lines containing a speci)c group of contiguous characters, before or after
them;
- Trim/Keep lines containing a speci)c group of contiguous characters;
- Trim away a From-To piece of line that may be at the row beginning, middle or end.
When applying the selected rule the program may:
- compare the characters ignoring or considering the di&erence between lower and
upper case;
- trim away all the blank lines if exist;
- trim away duplicate lines if appearing in sequence.
Both, Sort and Trim by rules, can be undone/redone from the Block Mode status even
if invoked from the List Mode and vice versa.
Download
Download from here the zip )le ZTEXTTR.zip (version 1.0, less than 50 KB).
Note - TextTrimmer has been devoloped with Microsoft VB.Net 2.0, so requires that
its framework should be installed on your Windows XP or Vista.
Usage conditions
- The TextTrimmer program can be freely used for personal and oGce purposes,
providing that you don't sell it and integrally maintain every copyright and author
information.
- File dimensions: TextTrimmer works on text )les or similar; rows over about 3080
characters length are splitted in parts; as for the rows number, the program becomes
more and more slow as they increase (with 3000 rows it may be still acceptable).
Have a good test and fun!!

Copyright Giorgio Altichieri - 10/2008. All rights reserved.


Back to my home page

Você também pode gostar