- title: `startswith`
body: |
- Outputs true if . starts with the given string argument.
+ Outputs `true` if . starts with the given string argument.
examples:
- program: '[.[]|startswith("foo")]'
- title: `endswith`
body: |
- Outputs true if . ends with the given string argument.
+ Outputs `true` if . ends with the given string argument.
examples:
- program: '[.[]|endswith("foo")]'
examples:
- program: '[.[]|ltrimstr("foo")]'
- input: ["fo", "foo", "barfoo", "foobar", "afoo"]
+ input: '["fo", "foo", "barfoo", "foobar", "afoo"]'
output: ['["fo","","barfoo","bar","afoo"]']
- title: `rtrimstr`
examples:
- program: '[.[]|rtrimstr("foo")]'
- input: ["fo", "foo", "barfoo", "foobar", "foob"]
+ input: '["fo", "foo", "barfoo", "foobar", "foob"]'
output: ['["fo","","bar","foobar","foob"]']
- title: `explode`
output: ['"The input was 42, which is one less than 43"']
- title: "Convert to/from JSON"
+ body: |
The `tojson` and `fromjson` builtins dump values as JSON texts
or parse JSON texts into values, respectively. The tojson
examples:
- program: '[.[]|tostring]'
input: '[1, "foo", ["foo"]]'
- output: '["1","foo","[\"foo\"]"]'
+ output: ['["1","foo","[\"foo\"]"]']
- program: '[.[]|tojson]'
input: '[1, "foo", ["foo"]]'
- output: '["1","\"foo\"","[\"foo\"]"]'
+ output: ['["1","\"foo\"","[\"foo\"]"]']
- program: '[.[]|tojson|fromjson]'
input: '[1, "foo", ["foo"]]'
- output: '[1,"foo",["foo"]]'
+ output: ['[1,"foo",["foo"]]']
- title: "Format strings and escaping"
body: |