Softanza
StartFrançais
Softanza
Reference · stzString

Find()

Find pcSubStr in the string: the positions of EVERY occurrence, as a list (engine-backed, codepoint-aware). (case-sensitive by default)

also: locate search for position of index of where is

also written: FindAll · FindSubString

Basic examples (2)

Softanza
# FindW reports those two positions
? @@( Q("...♥...♥...").FindW('@char = "♥"') )
Output
[ 4, 8 ]

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

Softanza
# FindW with isDigit(@char) reports the digit positions
? @@( Q("1 AA 6 B 0 CCC 6 DD 1 Z").FindW('isDigit(@char)') )
Output
[ 1, 6, 10, 16, 21 ]

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

Scope (4)

Softanza
oS = new stzString("tea rice tea fish")
? oS.Contains("tea")
? oS.NumberOfOccurrence("tea")
? @@( oS.FindAll("tea") )
Output
1
2
[ 1, 10 ]

run on 2026-10-02 04:24 inside the library at commit 0e72e2e2c; taken from 05-one-object-any-structure.en.md(opens in a new tab)

Softanza
o1 = new stzString("...emm...eh..emm...eh")
? @@( o1.FindMany([ "emm", "eh" ]) )
? @@(o1.FindManyAsSections([ "emm", "eh" ]))
? @@( o1.Find([ "emm", "eh" ]) )
? @@(o1.FindAsSections([ "emm", "eh" ])) # Of FindZZ() for short
Output
[ 4, 10, 14, 20 ]
[ [ 4, 6 ], [ 10, 11 ], [ 14, 16 ], [ 20, 21 ] ]
[ 4, 10, 14, 20 ]
[ [ 4, 6 ], [ 10, 11 ], [ 14, 16 ], [ 20, 21 ] ]

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

Softanza
# FindZZ locates the section of Programming
? @@( Q("Softanza Programming by Heart").FindZZ("Programming") )
# ReplaceInSection m->M inside [10,20]
o = new stzString("Softanza Programming by Heart")
o.ReplaceInSection("m", "M", 10, 20)
? o.Content()
Output
[ [ 10, 20 ] ]
Softanza PrograMMing by Heart

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

Softanza
oAB  = new stzString("ab")
big  = new stzString( oAB.Repeated(1000000) )
# NumberOfOccurrences('a') is 1,000,000 (> 65536)
? big.NumberOfOccurrences("a")
# FindAll('a') returns all 1,000,000 positions
? len(big.FindAll("a"))
# NumberOfOccurrences('ab') is 1,000,000
? big.NumberOfOccurrences("ab")
Output
1000000
1000000
1000000

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

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
no
does what the method does, then returns the object, so the call can be chained
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, FindAllCS, FindSubStringCS, FindWCS and 2 more
ST
yes
takes the position to start from (StartingAt) · FindST, FindSTZ, FindStD, FindSTZZ and 2 more
IB
no
takes bounds that are included (IncludingBounds)
XT
yes
the extended form: more parameters than the base method · FindXT
XTT
no
yet another extension: a further extended form, after XT
Z
yes
includes the position in what it returns · FindZ, FindDZ, FindSTZ, FindSTDZ
ZZ
yes
returns positions as sections, [start, end] · FindZZ, FindAllZZ, FindDZZ, FindSTZZ and 4 more
W
yes
selects by a condition · FindW, FindWCS
WF
no
selects by a condition, with the expressive keywords (@NextItem, @PreviousItem...)
D
yes
takes a direction, forward or backward (Directional) · FindD, FindDZ, FindDZZ, FindStD and 2 more
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, FindManyCS, FindManyZZ
Except
yes
takes exceptions, what to leave out (the exceptional form) · FindExceptZZ
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