Exemples de base (2)
o1 = new stzString("•♥••••♥••")
# FindLast('♥') is 7
? o1.FindLast("♥")
# FindLast('_') (absent) is 0
? o1.FindLast("_")7 0
exécuté le 2026-10-02 04:23 dans la bibliothèque au commit 0e72e2e2c ; tiré de 238_testing_findlast_on_a_small_string.ring(s'ouvre dans un nouvel onglet)
o1 = new stzString("---***---***---***---")
# HowMany('***') is 3
? o1.HowMany("***")
# the 3rd '***' starts at 16
? o1.Nth(3, "***")
# FindLast('***') is also 16
? o1.FindLast("***")3 16 16
exécuté le 2026-10-02 04:23 dans la bibliothèque au commit 0e72e2e2c ; tiré de 242_howmany.ring(s'ouvre dans un nouvel onglet)
Portée (7)
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)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)
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)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)
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)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)
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)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)
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)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)
oAB = new stzString("ab")
big = new stzString( oAB.Repeated(1000000) )
# NumberOfChars is 2,000,000
? big.NumberOfChars()
# Contains 'ab' is TRUE
? big.Contains("ab")
# FindFirst 'ab' is 1
? big.FindFirst("ab")
# FindLast 'ab' is 1,999,999
? big.FindLast("ab")2000000 1 1 1999999
exécuté le 2026-10-02 04:24 dans la bibliothèque au commit 0e72e2e2c ; tiré de 999_engine_string_millions_narrated.ring(s'ouvre dans un nouvel onglet)
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, "_")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).
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
- La classe stzString
- La référence du domaine : Chaînes de caractères
- Les autres méthodes de ces exemples : stzString.Contains · stzString.FindFirst · stzString.FindNth · stzString.HowMany · stzString.Nth · stzString.NumberOfChars

