Softanza
StartFrançais
Softanza
Reference · stzList

Find()

Find the given item: the positions of EVERY occurrence, as a list (engine-backed). (case-sensitive by default)

Basic examples (2)

Softanza
# find example 1
? @@( Q([1, 2, 3, 4, 5, 3, 7]).Find(3) )
Output
[ 3, 6 ]

run on 2026-10-02 04:22 inside the library at commit 0e72e2e2c; taken from 189_find.ring(opens in a new tab)

Softanza
o1 = new stzList( [ 0, 8, 0, 0, 1, 8, 0, 0 ] )
? @@( o1.FindW('{ This[ @i - 3 ] = This[ @i + 3 ] }') )
Output
[ 4 ]

run on 2026-10-02 04:22 inside the library at commit 0e72e2e2c; taken from 487_findwxt.ring(opens in a new tab)

Scope (8)

Softanza
o1 = new stzList([ 1, "a", 2, "b", 3, "c" ])
? o1.FindWF( func x { return isString(x) and Q(x).isLowercase() } )
Output
2
4
6

run on 2026-10-02 04:22 inside the library at commit 0e72e2e2c; taken from 530_findwxt.ring(opens in a new tab)

Softanza
o1 = new stzList([ "_", "_", 1:3, "_", 5:9, "_" ])
? o1.FindWF( func x { return Q(x).IsOneOfThese([ 1:3, 5:9 ]) } )
Output
3
5

run on 2026-10-02 04:22 inside the library at commit 0e72e2e2c; taken from 476_findwxt.ring(opens in a new tab)

Softanza
o1 = new stzList([ "a", "b", "e", "a", "c", "v", "e" ])
? o1.FindMany([ "a", "e" ])
? @@NL( o1.TheseItemsZ([ "a", "e" ]) )
Output
1
3
4
7

[
	[
		"a",
		[ 1, 4 ]
	],
	[
		"e",
		[ 3, 7 ]
	]
]

run on 2026-10-02 04:22 inside the library at commit 0e72e2e2c; taken from 460_findmany.ring(opens in a new tab)

Softanza
o1 = new stzList([ "1", "2", "♥", "4", "5", "♥", "6", "7", "♥", "9" ])
? @@( o1.Find("♥") ) + NL
? @@( o1.AntiFind("♥") ) + NL
Output
[ 3, 6, 9 ]

[ 1, 2, 4, 5, 7, 8, 10 ]

run on 2026-10-02 04:22 inside the library at commit 0e72e2e2c; taken from 34_find_and_antifind_in_stzlist.ring(opens in a new tab)

Softanza
o1 = new stzList([ :one, :two, :one, :three, :one, :four ])
? o1.FindMany([ :one, :five ])
? @@(o1.TheseItemsZ([ :one, :five ]))
Output
1
3
5

[ [ "one", [ 1, 3, 5 ] ], [ "five", [ ] ] ]

run on 2026-10-02 04:22 inside the library at commit 0e72e2e2c; taken from 467_findmany.ring(opens in a new tab)

Softanza
o1 = new stzList(["_", "A", "*", "_", "B", "*", "_", "C", "*" ])
? o1.FindW( :Where = ' @NextItem = "*" ' )
? o1.ItemsW( :Where = ' @NextItem = "*" ' )
Output
2
5
8

A
B
C

run on 2026-10-02 04:22 inside the library at commit 0e72e2e2c; taken from 548_findwxt.ring(opens in a new tab)

Softanza
o1 = new stzList([ "a", "E", "a", "c", "V", "E" ])
? o1.FindMany([ "a", "c" ])
? o1 - These([ "a", "c" ]) # Same as: o1.RemoveItemsAtPositions([ 1, 3, 4 ])
Output
1
3
4

E
V
E

run on 2026-10-02 04:22 inside the library at commit 0e72e2e2c; taken from 461_findmany.ring(opens in a new tab)

Softanza
o1 = new stzList([ 2, 8, 2, 2, 11, 2, 11, 7, 7, 4, 2, 1, 3, 2, 10, 8, 3, 3, 3, 6, 8 ])
? o1.FindW( '{ @Number = @NextNumber }' )
? o1.FindW( '{ This[@i] = This[@i+1] }' )
Output
3
8
17
18

3
8
17
18

run on 2026-10-02 04:22 inside the library at commit 0e72e2e2c; taken from 485_findwxt.ring(opens in a new tab)

and 14 more in the tests

The extensions of this method

Each extension, and whether it exists for this method; an extension that exists combines with the others (FindSTCS).

Extension
Exists
What it adds · The names
Q
yes
does what the method does, then returns the object, so the call can be chained · FindManyQ, FindManyCSQ
QQ
no
chains on the next, more specific type of object (the Q ladder)
QQQ
no
chains on the most specific type of object (the Q ladder)
QRT
no
returns the result as an object of the requested type
CS
yes
takes a case-sensitivity flag · FindCS, FindWCS, FindManyCS, FindManyCSQ
ST
no
takes the position to start from (StartingAt)
IB
no
takes bounds that are included (IncludingBounds)
XT
no
the extended form: more parameters than the base method
XTT
no
yet another extension: a further extended form, after XT
Z
no
includes the position in what it returns
ZZ
no
returns positions as sections, [start, end]
W
yes
selects by a condition · FindW, FindWCS
WF
yes
selects by a condition, with the expressive keywords (@NextItem, @PreviousItem...) · FindWF
D
no
takes a direction, forward or backward (Directional)
F
no
takes a function (the condition or the update is given as a function); the forms document also uses F for the future form, which defers the action
Many
yes
works on a collection of items instead of one (the plural form) · FindMany, FindManyQ, FindManyCS, FindManyCSQ
Except
no
takes exceptions, what to leave out (the exceptional form)
U
no
returns the result without duplication

Every example is a test file of the library, run inside the library for this page; only those whose output kept every promise their file wrote are shown.

See also