vslice
Definition: | sequence res = vslice(sequence source, object column, error_control=0) |
Description: |
Extract a specified column or vertical slice from a sequence. source: the sequence from which to extract a vertical column. column: positive integer or pair of integers (latter is not Euphoria-compatible). error_control: 0 => crash, integer => return short, sequence => replacement[s]. Returns a sequence or string of at most length(source). The result will be a string if column is an integer and source is either a list of strings or each element extracted happens to be an integer(/character) in the range 0..255. |
pwa/p2js: | Supported. |
Example: |
sequence s = {{5,1}, {5,2}, {5,3}, 4} ?vslice(s,2,1) -- prints {1,2,3} -- (omitting error_control crashes) ?vslice(s,1,1) -- prints {5,5,5} -- "" ?vslice(s,{1,2},1) -- prints {{5,1},{5,2},{5,3}} -- "" ?vslice(s,{1,2},{1}) -- prints {{5,1},{5,2},{5,3},1} -- ""(Technically the first two results are binary strings that ? prettifies to look like dword-sequences, as opposed to "\x01\x02\x03", x"010203", "\x05\x05\x05", or x"050505".) |
Implementation: | See builtins\vslice.e (an autoinclude) for details of the actual implementation. |
See Also: | columnize |
