Add indices(s), improve index(s), rindex(s)

Now these deal with arrays as input and `s` being an array or a scalar.
This commit is contained in:
Nicolas Williams committed 2014-06-08 02:01:44 -05:00
1 parent ef4f3a54fe
commit 1dbe9317bc
6 files changed
+61 -4

No files matched your search

+14 -2
View File
@@ -664,9 +664,21 @@ def inc(x): x |= .+1; inc(.[].a)
"a,b,, c, d,ef, , ghi, jklmn, o"
[4,7,13,15,20,27]
[(index(","), rindex(","))]
[(index(","), rindex(",")), indices(",")]
"a,bc,def,ghij,klmno"
[1,13]
[1,13,[1,4,8,13]]
indices(1)
[0,1,1,2,3,4,1,5]
[1,2,6]
indices([1,2])
[0,1,2,3,1,4,2,5,1,2,6,7]
[1,8]
indices(", ")
"a,b, cd,e, fgh, ijkl"
[3,9,14]
[.[]|split(",")]
["a, bc, def, ghij, jklmn, a,b, c,d, e,f", "a,b,c,d, e,f,g,h"]