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