Test starts/endswith and string multiplication
This commit is contained in:
1 parent
5989dbdfcf
commit
63bed9bdf1
1 file changed
+13
@@ -574,6 +574,19 @@ def inc(x): x |= .+1; inc(.[].a)
|
|||||||
{}
|
{}
|
||||||
[true, true, false]
|
[true, true, false]
|
||||||
|
|
||||||
|
# string operations
|
||||||
|
[.[]|startswith("foo")]
|
||||||
|
["fo", "foo", "barfoo", "foobar", "barfoob"]
|
||||||
|
[false, true, false, true, false]
|
||||||
|
|
||||||
|
[.[]|endswith("foo")]
|
||||||
|
["fo", "foo", "barfoo", "foobar", "barfoob"]
|
||||||
|
[false, true, true, false, false]
|
||||||
|
|
||||||
|
[.[] * 3]
|
||||||
|
["a", "ab", "abc"]
|
||||||
|
["aaa", "ababab", "abcabcabc"]
|
||||||
|
|
||||||
map(.[1] as $needle | .[0] | contains($needle))
|
map(.[1] as $needle | .[0] | contains($needle))
|
||||||
[[[],[]], [[1,2,3], [1,2]], [[1,2,3], [3,1]], [[1,2,3], [4]], [[1,2,3], [1,4]]]
|
[[[],[]], [[1,2,3], [1,2]], [[1,2,3], [3,1]], [[1,2,3], [4]], [[1,2,3], [1,4]]]
|
||||||
[true, true, true, false, false]
|
[true, true, true, false, false]
|
||||||
|
|||||||
Reference in new issue
Block a user