Mixed-mode end-relative column reference item


The standard and end-relative notations discussed above work well for most cases, but a problem arises when you want to reference both ends of a variable-sized item.  For example, suppose you had some string that varied in size, and you wanted to reference all but the first two and last two positions.  (That is, you wanted to start with the third character in, from both ends.)  You can omit the first 2 positions by using 3+ to skip the first two, and you can get the last two by 2-1* but there is no way to get a string that omits both sets of characters on both ends.


This is a situation you will not encounter often, but if you do, standard column notation will not handle this.


Instead, you must use mixed-mode end-relative notation.  In this notation, the first column number you specify is a ‘normal’ one, relative to the left side, and numbered from left to right from 1 up.  The second number is end-relative, numbered right to left starting with 1 and up leftward, as is done for standard end-relative columns.  Because the second number is end-relative, it must be followed by an * asterisk, to make clear your intentions.  By using mixed-mode end-relative notation, you can define a column range that is relative to both ends at the same time.


Mixed-mode column ranges use a separator of / slash rather than dash between the two numbers.  In our example, reference all but the first two and last two positions of some string, you would use 3/3*.  In a string of length 10, this would select the same columns as 3-8 would.


When you need to use mixed-mode columns and also want to reverse the order of the columns, use a separator of \ backslash rather than / slash between the two numbers, such as 3\3*.  In a string of length 10, this would select the same set of reversed columns as 8-3 would.  That is, first columns 3 to 8 would be selected, and then the character order would be reversed.


The Mapping Strings Quick Reference has several examples of how all the various column reference types are specified and what they mean.



Created with the Personal Edition of HelpNDoc: Easy to use tool to create HTML Help files and Help web sites