Knap.md
LogicFiltersVariablesAPIGitHub ↗

Guide

VariablesLogicFilters

Reference

API

Project

GitHub ↗npm ↗

slice

Extract part of a string or array.

Filters/slice

Syntax

{{ value | slice:1 }}{{ value | slice:1,4 }}

Example

01

Basic usage

InputTS
1{2  "word": "hello"3}
TemplateKNAP
1{{ word | slice:1,4 }}
OutputKNAP
1ell

Behavior

  • The first index is inclusive and the second is exclusive. Negative indexes count from the end.

Related filters

firstReturn the first item in an array.lastReturn the last item in an array.
Previous← reverseNextsplit →
Knap is open source under the MIT license.View source ↗

On this page

SyntaxExamplesBehaviorRelated filters
slice filter — Knap