Softanza
DémarrerEnglish
Softanza
Référence · stzString

FindNth()

find all / find nth

Exemples de base (2)

Softanza
o1 = new stzString("12*45*78*90")
# the 2nd star from 4
? o1.FindNthST(2, "*", :StartingAt = 4)
# the first star from 4
? o1.FindFirstST("*", :StartingAt = 4)
Sortie
9
6

exécuté le 2026-10-02 04:24 dans la bibliothèque au commit 0e72e2e2c ; tiré de 555_findnthst.ring(s'ouvre dans un nouvel onglet)

Softanza
o1 = new stzString("•♥••••♥••")
# the 2nd char equal to '♥' is at position 7
? o1.FindNthW(2, '@char = "♥"')
# the 2nd substring equal to '•♥•' starts at position 6
? o1.FindNthW(2, '@substring = "•♥•"')
Sortie
7
6

exécuté le 2026-10-02 04:23 dans la bibliothèque au commit 0e72e2e2c ; tiré de 246_findnthw.ring(s'ouvre dans un nouvel onglet)

Portée (7)

Softanza
o1 = new stzString("12♥♥♥67♥♥♥12♥♥♥")
# the 2nd from 3
? o1.FindNthST(2, "♥♥♥", :StartingAt = 3)
# the first from 5
? o1.FindFirstST("♥♥♥", :StartingAt = 5)
# the last from 6
? o1.FindLastST("♥♥♥", :StartingAt = 6)
Sortie
8
8
13

exécuté le 2026-10-02 04:24 dans la bibliothèque au commit 0e72e2e2c ; tiré de 317_using_st_and_std_extension.ring(s'ouvre dans un nouvel onglet)

Softanza
o1 = new stzString("12♥♥♥67♥♥♥12♥♥♥")
# the first from 6
? o1.FindFirstST("♥♥♥", :StartingAt = 6)
# the last from 6
? o1.FindLastST("♥♥♥", :StartingAt = 6)
# the 2nd from 6
? o1.FindNthST(2, "♥♥♥", :StartingAt = 6)
Sortie
8
13
13

exécuté le 2026-10-02 04:24 dans la bibliothèque au commit 0e72e2e2c ; tiré de 323_findfirstst.ring(s'ouvre dans un nouvel onglet)

Softanza
o1 = new stzString("bla {♥♥♥} blaba bla {♥♥♥} blabla")
# the first from 8
? o1.FindFirstST("♥♥♥", :StartingAt = 8)
# the last from 8
? o1.FindLastST("♥♥♥", :Startingat = 8)
# the 2nd from 3
? o1.FindNthST(2, "♥♥♥", :StartingAt = 3)
Sortie
22
22
22

exécuté le 2026-10-02 04:24 dans la bibliothèque au commit 0e72e2e2c ; tiré de 351_findfirstst.ring(s'ouvre dans un nouvel onglet)

Softanza
o1 = new stzString("12♥♥♥67♥♥♥12♥♥♥")
# the 1st from position 3 is 3 itself
? o1.FindNthST(1, "♥♥♥", :StartingAt = 3)
# the next after 3
? o1.FindNext("♥♥♥", :StartingAt = 3)
# the previous before 10 must END before 10
? o1.FindPrevious("♥♥♥", :StartingAt = 10)
Sortie
3
8
3

exécuté le 2026-10-02 04:24 dans la bibliothèque au commit 0e72e2e2c ; tiré de 316_findnthst.ring(s'ouvre dans un nouvel onglet)

Softanza
o1 = new stzString("12♥♥♥67♥♥♥12♥♥♥")
# the first backward from 12
? o1.FindFirstSTD("♥♥♥", :StartingAt = 12, :Backward)
# the last backward from 12
? o1.FindLastSTD("♥♥♥", :StartingAt = 12, :Backward)
# the 2nd backward from 12
? o1.FindNthSTD(2, "♥♥♥", :StartingAt = 12, :Backward)
Sortie
8
3
3

exécuté le 2026-10-02 04:24 dans la bibliothèque au commit 0e72e2e2c ; tiré de 325_findfirststd.ring(s'ouvre dans un nouvel onglet)

Softanza
o1 = new stzString("12♥♥♥67♥♥♥12♥♥♥")
# the 2nd backward from 10 (:Going spelling)
? o1.FindNthSTD(2, "♥♥♥", :StartingAt = 10, :Going = :Backward)
# the first backward from 14 (bare :Backward)
? o1.FindFirstSTD("♥♥♥", :StartingAt = 14, :Backward)
# the last backward from 6 (:Direction spelling)
? o1.FindLastSTD("♥♥♥", :StartingAt = 6, :Direction = :Backward)
Sortie
3
8
3

exécuté le 2026-10-02 04:24 dans la bibliothèque au commit 0e72e2e2c ; tiré de 317_using_st_and_std_extension.ring(s'ouvre dans un nouvel onglet)

Softanza
o1 = new stzString("ab_cd_ef_gh")
# the first underscore
? o1.FindFirst("_")
# a missing star from 4
? o1.FindFirstST("*", :StartingAt = 4)
# the underscore from 3
? o1.FindFirstST("_", :StartingAt = 3)
# the last underscore
? o1.FindLast("_")
# no last star
? o1.FindLast("*")
# the 2nd underscore
? o1.FindNth(2, "_")
Sortie
3
0
3
9
0
6

exécuté le 2026-10-02 04:24 dans la bibliothèque au commit 0e72e2e2c ; tiré de 508_findfirst.ring(s'ouvre dans un nouvel onglet)

Les extensions de cette méthode

Chaque extension, et si elle existe pour cette méthode ; une extension qui existe se compose avec les autres (FindSTCS).

Extension
Existe
Ce qu'elle ajoute · Les noms
Q
non
fait ce que fait la méthode, puis rend l'objet, pour que l'appel puisse s'enchaîner
QQ
non
enchaîne sur le type d'objet suivant, plus précis (l'échelle des Q)
QQQ
non
enchaîne sur le type d'objet le plus précis (l'échelle des Q)
QRT
non
rend le résultat comme un objet du type demandé
CS
oui
prend un indicateur de sensibilité à la casse · FindNthCS
ST
oui
prend la position de départ (StartingAt) · FindNthST, FindNthSTD, FindNthSTZZ, FindNthSTDZZ
IB
non
prend des bornes incluses (IncludingBounds)
XT
oui
la forme étendue : plus de paramètres que la méthode de base · FindNthXT
XTT
non
encore une extension : une forme étendue de plus, après XT
Z
oui
inclut la position dans ce qu'elle rend · FindNthZ
ZZ
oui
rend les positions comme des sections, [début, fin] · FindNthZZ, FindNthDZZ, FindNthSTZZ, FindNthSTDZZ
W
oui
choisit selon une condition · FindNthW
WF
non
choisit selon une condition, avec les mots-clés expressifs (@NextItem, @PreviousItem...)
D
oui
prend une direction, en avant ou en arrière (Directional) · FindNthD, FindNthDZZ, FindNthSTD, FindNthSTDZZ
F
non
prend une fonction (la condition ou la mise à jour est donnée comme une fonction) ; le document des formes emploie aussi F pour la forme future, qui diffère l'action
Many
non
travaille sur une collection d'éléments au lieu d'un seul (la forme plurielle)
Except
non
prend des exceptions, ce qu'il faut laisser de côté (la forme exceptionnelle)
U
non
rend le résultat sans doublon

Chaque exemple est un fichier de test de la bibliothèque, exécuté dans la bibliothèque pour cette page ; seuls ceux dont la sortie a tenu toutes les promesses écrites par leur fichier sont montrés. Les explications, les titres et le code sont ceux de la bibliothèque, en anglais.

Voir aussi