Rev 12174 | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
32 | reyssat | 1 | !! +exec+ +var+ +string+ |
11210 | bpr | 2 | tit:text |
3 | type:$type_both |
||
11292 | bpr | 4 | syntax:!text ``operation'' ``parameter'' |
11210 | bpr | 5 | mean:This is intended to be a very powerful text manipulation tool,\ |
17228 | bpr | 6 | allowing very sophisticated processing of long text strings with high speed. <br>\ |
11292 | bpr | 7 | Many of the ``operations'' accept masks. A mask is a string composed of ``0''s and ``1''s. \ |
11210 | bpr | 8 | For operations which accept a mask, only characters at positions whose corresponding\ |
11292 | bpr | 9 | character in the mask is not a ``0'' are processed. (In this sense positions\ |
10 | corresponding to ``0''s are ``masked''.) Empty mask is considered\ |
||
17228 | bpr | 11 | as of being entirely composed of ``1''s. <br>\ |
11292 | bpr | 12 | A mask which is too short repeats itself, unless it terminates with a ``+'',\ |
13 | in which case it fills the rest with ``1''s, or with a ``-'', in which case\ |
||
17228 | bpr | 14 | it fills the rest with ``0''s. <br>\ |
11292 | bpr | 15 | For the time being, implemented ``operations'' are as follows.\ |
11210 | bpr | 16 | <ul>\ |
17228 | bpr | 17 | <li><span class="tt">!text common ``text1'' and ``text2'' [mask ``maskstring'']</span> <br>\ |
11292 | bpr | 18 | Extracts characters in ``text1'' one by one, for those identical\ |
19 | to the corresponding characters in ``text2'' and whose\ |
||
20 | positions are not masked by ``maskstring''.\ |
||
21 | </li><li><span class="tt">!text compare ``text1'' and ``text2''\ |
||
17228 | bpr | 22 | </span> <br>\ |
11292 | bpr | 23 | Compares the strings ``text1'' and ``text2'' character by character, \ |
12174 | bpr | 24 | and returns a mask string with ``0''s on positions where the corresponding characters in ``text1''\ |
11292 | bpr | 25 | and ``text2'' are equal, and ``1''s otherwise.\ |
17228 | bpr | 26 | </li><li><span class="tt">!text copy ``text'' [mask ``maskstring'']</span> <br>\ |
11292 | bpr | 27 | Returns non-masked characters in ``text''.\ |
17228 | bpr | 28 | </li><li><span class="tt">!text count ``charlist'' in ``text'' [mask ``maskstring'']</span> <br>\ |
11292 | bpr | 29 | Returns the number of characters in ``text'' whose positions\ |
30 | are not masked by ``maskstring'', and who appear in ``charlist''.\ |
||
17228 | bpr | 31 | </li><li><span class="tt">!text diff ``text1'' from ``text2'' [mask ``maskstring'']</span> <br>\ |
11292 | bpr | 32 | Extracts characters in ``text1'' one by one, for those different to the corresponding \ |
17228 | bpr | 33 | characters in ``text2'' and whose positions are not masked by ``maskstring''. <br>\ |
11210 | bpr | 34 | (Synonyme of diff: differ).\ |
11292 | bpr | 35 | </li><li><span class="tt">!text expand ``text'' using ``maskstring''\ |
17228 | bpr | 36 | </span> <br>\ |
11292 | bpr | 37 | Produces a string, where positions corresponding to ``0''s in\ |
38 | ``maskstring'' are filled by `` '' (the space character),\ |
||
39 | and where positions corresponding to ``1''s in ``maskstring'' are filled by characters of \ |
||
40 | ``text''. The characters in ``text'' are used one by one, and the\ |
||
41 | resulting string stops when all the characters in ``text'' are exhausted \ |
||
11210 | bpr | 42 | (or when the string reaches the length limit).\ |
17228 | bpr | 43 | </li><li><span class="tt">!text insert ``text1'' into ``text2'' [mask ``maskstring'']</span> <br>\ |
11292 | bpr | 44 | Returns ``text2'' with non-masked characters replaced by characters ``text1''. \ |
45 | Characters in ``text1'' are used one by one (without taking into account the masking), and\ |
||
46 | the replacement stops when there is no character left in ``text1''.\ |
||
17228 | bpr | 47 | </li><li><span class="tt">!text interact ``text1'' and ``text2'' table ``itab'' [mask ``maskstring'']</span> <br>\ |
11210 | bpr | 48 | Returns a new text which is result of interactions of characters\ |
11292 | bpr | 49 | in corresponding positions in ``text1'' and ``text2''. The rule of the interaction is defined in\ |
17228 | bpr | 50 | ``itab''. <br> ``itab'' contains n+1 lines, each of n characters.\ |
11210 | bpr | 51 | The first line defines the characters corresponding to each position\ |
52 | in the following n lines which defines the multiplication table.\ |
||
17228 | bpr | 53 | <br>\ |
11210 | bpr | 54 | The multiplication table needs not to be symmetric. In this case, the rows correspond \ |
11292 | bpr | 55 | to characters in ``text1'', and the columns correspond to characters in ``text2''.\ |
17228 | bpr | 56 | <br>\ |
11292 | bpr | 57 | If ``text1'' or ``text2'' contains a character not in the first line of ``itab'', \ |
11210 | bpr | 58 | the interaction at the corresponding position is considered as empty. Also, masked\ |
17228 | bpr | 59 | positions are ignored.<br>\ |
11292 | bpr | 60 | If ``text1'' and ``text2'' have different lengths, the longer is cut to fit the shorter.\ |
17228 | bpr | 61 | </li><li><span class="tt">!text mark ``charlist'' in ``text''</span> <br>\ |
11292 | bpr | 62 | Returns a mask string with ``1''s on positions where the corresponding character in ``text'' \ |
63 | appears in ``charlist'', and with ``0''s on other positions.\ |
||
17228 | bpr | 64 | </li><li><span class="tt">!text max ``text1'' and ``text2'' [mask ``maskstring'']</span> <br>\ |
11210 | bpr | 65 | Returns a string which at each position is the character with highest\ |
11292 | bpr | 66 | ASCII code between corresponding characters in ``text1'' and ``text2''. \ |
11210 | bpr | 67 | The length of the result is that of the longest of the two. Masked positions are skipped.\ |
17228 | bpr | 68 | </li><li><span class="tt">!text min ``text1'' and ``text2'' [mask ``maskstring'']</span> <br>\ |
11210 | bpr | 69 | Returns a string which at each position is the character with lowest\ |
11292 | bpr | 70 | ASCII code between corresponding characters in ``text1'' and ``text2''. \ |
11210 | bpr | 71 | The length of the result is that of the\ |
72 | shortest of the two. Masked positions are skipped.\ |
||
17228 | bpr | 73 | </li><li><span class="tt">!text occur ``charlist'' in ``text'' [mask ``maskstring'']</span> <br>\ |
74 | Returns characters in ``charlist'' which occur in unmasked positions in ``text''. <br>\ |
||
11210 | bpr | 75 | (Synonymes of occur: appear, occurrence).\ |
17228 | bpr | 76 | </li><li><span class="tt">!text remove ``charlist'' in ``text'' [mask ``maskstring'']</span> <br>\ |
11292 | bpr | 77 | Returns ``text'' in which masked characters and characters\ |
17228 | bpr | 78 | appearing in ``charlist'' are removed. <br>(Synonymes of remove: drop, delete).\ |
79 | </li><li><span class="tt">!text reorder ``text'' by ``orderlist''</span> <br>\ |
||
11292 | bpr | 80 | Returns a reordered ``text'' using the order list ``orderlist''. Reordering is cyclic \ |
17228 | bpr | 81 | if ``orderlist'' is shorter than ``text''. <br>\ |
11292 | bpr | 82 | ``orderlist'' must be a list of n positive integers, which\ |
83 | is a permutation of the set {1,...,n}. If ``orderlist'' contains\ |
||
11210 | bpr | 84 | items other than integers within the bound, empty string is returned.\ |
11292 | bpr | 85 | However, unicity check is not performed on items of ``orderlist''.\ |
17228 | bpr | 86 | </li><li><span class="tt">!text repeat ``text'' to ``len''</span> <br>\ |
11292 | bpr | 87 | Repeat the string ``text'' cyclicly, up to length ``len''.\ |
17228 | bpr | 88 | </li><li><span class="tt">!text reverse ``text''</span> <br>\ |
11292 | bpr | 89 | Reverse the order of ``text'', with the last character coming first, etc.\ |
17228 | bpr | 90 | </li><li><span class="tt">!text select ``charlist'' in ``text'' [mask ``maskstring'']</span> <br>\ |
11292 | bpr | 91 | Returns ``text'' in which masked characters and characters not appearing in \ |
17228 | bpr | 92 | ``charlist'' are removed. <br> (Synonymes of select: pick, pickup).\ |
11210 | bpr | 93 | </li></ul> |