Difference between revisions of "Cutting line portion"
(Created page with '<noinclude>{{manversion|6.0.0.16}}__NOTOC__</noinclude>{{todo|Cutting line portion}}') |
|||
Line 1: | Line 1: | ||
− | <noinclude>{{manversion|6.0.0.16}}__NOTOC__</noinclude>{{todo|Cutting line portion}} | + | <noinclude>{{manversion|6.0.0.16}}__NOTOC__</noinclude> |
+ | Cutting portion of a {{defined|line}} is divided into two successive parts. First, {{defined|columns}} are cut from the {{defined|line}}, by either: | ||
+ | * {{field|Cutting line portion|Entire line}}, which keeps the entire original {{defined|line}}. | ||
+ | * {{field|Cutting line portion|Columns}}, which allows to specify one or more subsequent {{defined|columns}} between {{field|Cutting line portion|Columns from}} and {{field|Cutting line portion|Columns to}} (inclusive). Individual {{defined|columns}} are separated by {{field|Cutting line portion|Delimiting characters}}, which means that the {{defined|line}} is scanned for these {{defined|delimiting characters}}, and wherever a {{defined|delimiting character}} is found (any character from {{field|Cutting line portion|Delimiting characters}}), old {{defined|column}} ends before this {{defined|delimiter}} and a new {{defined|column}} begins after this {{defined|delimiter}}. There can be as many {{defined|delimiting characters}} as necessary and all of them delimit {{defined|columns}} equally and indiscriminately. | ||
+ | ** Optionally, {{field|Cutting line portion|Delimit by entire phrase rather than separate characters}} can be used to stop treating {{field|Cutting line portion|Delimiting characters}} as a set of individual characters, and scan for an entire {{defined|delimiting phrase}} instead. | ||
+ | ** Optionally, {{field|Cutting line portion|Treat any sequence of delimiters as single delimiter}} can be used to count several successive {{defined|delimiters}} as a single {{defined|delimiter}}. This can be useful, for example, if input {{defined|columns}} are aligned by spaces into neat visual columns, where each two {{defined|columns}} are delimited by an arbitrary-length sequence of spaces. Such sequences need to be treated as indivisible column {{defined|delimiters}}. | ||
+ | *** Note that even different delimiting characters are treated as a single indivisible {{defined|delimiter}}, if found in sequence. | ||
+ | ** Optionally, {{field|Cutting line portion|Calculate columns backwards: from right to left}} can be used to numerate the {{defined|columns}} from the end of line rather than the usual way. Note, however, that this only affects how the {{defined|columns}} are numbered before they are cut; the text of the {{defined|columns}} is not reversed. | ||
+ | ** Note: {{defined|Delimiters}} are not included within the {{defined|column}} being cut. However, if two or more subsequent {{defined|columns}} are cut together, inner {{defined|delimiters}} are not removed and become part of the line portion being cut. | ||
+ | ** Note: {{field|Cutting line portion|Delimiting characters}} are always {{defined|case sensitive}}. | ||
+ | |||
+ | Note: {{defined|Columns}} are cut for each line separately, therefore the total number of {{defined|columns}} on a line may vary from line to line. If specified {{defined|column}} number is beyond the total number of {{defined|columns}}, empty zero-length portion is cut for such {{defined|column}} from that line. Therefore, it is allowed to cut {{defined|columns}} 2-7, even though some lines do not have enough {{defined|columns}} to offer. | ||
+ | |||
+ | {{todo|Cutting line portion}} | ||
+ | |||
+ | After the first part (cutting {{defined|columns}} from the line), the resulting portion of the line can be further cropped by turning {{field|Cutting line portion|Use only characters}} option on, and specifying a range of character positions between {{field|Cutting line portion|from position}} and {{field|Cutting line portion|to position}}. This cuts off everyting before the {{field|Cutting line portion|from position}} and everyting after the {{field|Cutting line portion|to position}}. | ||
+ | * {{field|Cutting line portion|Calculate the position backwards: from right to left}} can be used to numerate the character positions from the end of line rather than the usual way. Note, however, that this only affects how the positions are numbered before they are cropped; the text itself is not reversed. | ||
+ | |||
+ | Note: Range of character positions is always cropped after {{defined|columns}} are cut. If a range is specified beyond cut {{defined|columns}}, empty zero-length portion is cropped from that line, even if the original line continues after the cut {{defined|columns}}. In other words, range of character positions cannot bring back what has already been cut off by previous step. | ||
+ | |||
+ | Note: There is currently no way to cut {{defined|columns}} after cropping a range of character positions. | ||
+ | |||
+ | Note: {{button|Cutting line portion|Column preview}} button displays a small portion of lines transformed by current dialog values. Be aware that preview is always generated from the current selection. If there is no selection, then there is nothing to preview. | ||
+ | |||
+ | Example: A line {{string|HELLO WORLD}} would be divided into: | ||
+ | * two columns ({{string|HELLO}} and {{string|WORLD}}) — if delimited by a Space character; | ||
+ | * four columns ({{string|H}}, {{string|LL}}, {{string| W}} and {{string|RLD}}) — if delimited by a set of {{string|EO}} characters; | ||
+ | * four columns ({{string|HE}}, ''<nowiki>{empty}</nowiki>'', {{string|O WOR}} and {{string|D}}) — if delimited by an {{string|L}} character; | ||
+ | ** but only three columns ({{string|HE}}, {{string|O WOR}} and {{string|D}}) — if {{field|Cutting line portion|Treat any sequence of delimiters as single delimiter}} option is turned on; | ||
+ | * and only one column ({{string|HELLO WORLD}}) — if delimited by an {{string|X}} character, {{defined|lowercase}} {{string|e}} character, or if delimited by no characters — this is because none of these characters are found on the examined line. |
Revision as of 21:34, 18 May 2011
Cutting portion of a line
is divided into two successive parts. First, columns
are cut from the line
, by either:
- Entire line, which keeps the entire original
line
. - Columns, which allows to specify one or more subsequent
columns
between Columns from and Columns to (inclusive). Individualcolumns
are separated by Delimiting characters, which means that theline
is scanned for thesedelimiting characters
, and wherever adelimiting character
is found (any character from Delimiting characters), oldcolumn
ends before thisdelimiter
and a newcolumn
begins after thisdelimiter
. There can be as manydelimiting characters
as necessary and all of them delimitcolumns
equally and indiscriminately.- Optionally, Delimit by entire phrase rather than separate characters can be used to stop treating Delimiting characters as a set of individual characters, and scan for an entire
delimiting phrase
instead. - Optionally, Treat any sequence of delimiters as single delimiter can be used to count several successive
delimiters
as a singledelimiter
. This can be useful, for example, if inputcolumns
are aligned by spaces into neat visual columns, where each twocolumns
are delimited by an arbitrary-length sequence of spaces. Such sequences need to be treated as indivisible columndelimiters
.- Note that even different delimiting characters are treated as a single indivisible
delimiter
, if found in sequence.
- Note that even different delimiting characters are treated as a single indivisible
- Optionally, Calculate columns backwards: from right to left can be used to numerate the
columns
from the end of line rather than the usual way. Note, however, that this only affects how thecolumns
are numbered before they are cut; the text of thecolumns
is not reversed. - Note:
Delimiters
are not included within thecolumn
being cut. However, if two or more subsequentcolumns
are cut together, innerdelimiters
are not removed and become part of the line portion being cut. - Note: Delimiting characters are always
case sensitive
.
- Optionally, Delimit by entire phrase rather than separate characters can be used to stop treating Delimiting characters as a set of individual characters, and scan for an entire
Note: Columns
are cut for each line separately, therefore the total number of columns
on a line may vary from line to line. If specified column
number is beyond the total number of columns
, empty zero-length portion is cut for such column
from that line. Therefore, it is allowed to cut columns
2-7, even though some lines do not have enough columns
to offer.
This section is incomplete and wants to be finished later. |
TODO: Cutting line portion |
After the first part (cutting columns
from the line), the resulting portion of the line can be further cropped by turning Use only characters option on, and specifying a range of character positions between from position and to position. This cuts off everyting before the from position and everyting after the to position.
- Calculate the position backwards: from right to left can be used to numerate the character positions from the end of line rather than the usual way. Note, however, that this only affects how the positions are numbered before they are cropped; the text itself is not reversed.
Note: Range of character positions is always cropped after columns
are cut. If a range is specified beyond cut columns
, empty zero-length portion is cropped from that line, even if the original line continues after the cut columns
. In other words, range of character positions cannot bring back what has already been cut off by previous step.
Note: There is currently no way to cut columns
after cropping a range of character positions.
Note: Column preview button displays a small portion of lines transformed by current dialog values. Be aware that preview is always generated from the current selection. If there is no selection, then there is nothing to preview.
Example: A line HELLO WORLD would be divided into:
- two columns (HELLO and WORLD) — if delimited by a Space character;
- four columns (H, LL, W and RLD) — if delimited by a set of EO characters;
- four columns (HE, {empty}, O WOR and D) — if delimited by an L character;
- but only three columns (HE, O WOR and D) — if Treat any sequence of delimiters as single delimiter option is turned on;
- and only one column (HELLO WORLD) — if delimited by an X character,
lowercase
e character, or if delimited by no characters — this is because none of these characters are found on the examined line.