aa_macro syntax 
 aa_macro source 
 HTML source 
 HTML render 
Key

§ 4.99 - [slice] Built-In

Mnemonic aid: lslice SLICE content

This built-in returns a portion of the content.

sliceSpec can be any of the following, where a, b and c are integers:

a ------pulls that character out of the string
a:b ----pulls from a to b-1
a:b:c --pulls from a to b-1, stepping by c
:b -----pulls from beginning to b-1
a: -----pulls from a to end
::c ----pulls from beginning to end, stepping by c
:b:c ---pulls from beginning to b-1, stepping by c
a::c ---pulls from a to end, stepping by c
Tip: When a slice component a or b is negative, then it refers to a character position relative to the end of the list. When c is negative, the step goes from the end of the list towards the beginning of the list.

[slice sliceSpec,content]

[slice 4,foobarbip]
[slice 3:6,foobarbip]
[slice 1:9:2,foobarbip]
[slice :3,foobarbip]
[slice 3:,foobarbip]
[slice ::2,foobarbip]
[slice :3:2,foobarbip]
[slice 2::3,foobarbip]
[slice :-1,foobarbip]
[slice ::-1,foobarbip]

[style reverse [slice ::-1,[b]]]
{reverse xyzzy}

a
bar
obri
foo
barbip
foabp
fo
orp
foobarbi
pibraboof

yzzyx
a bar obri foo barbip foabp fo orp foobarbi pibraboof yzzyx

Other built-ins used here:  [b]  and  [style] 

Keyboard Navigation
, Previous Page . Next Page t TOC i Index

Valid HTML 4.01 Loose
 

This manual was generated with wtfm
wtfm uses aa_macro and SqLite
aa_macro uses Python 2.7