Section()
The substring from position n1 to n2 (inclusive, codepoint-aware).
also: substring slice part portion extract characters between two positions
also written: Slice
Basic examples (2)
# 456
? StzStringQ("123456789").Section(4, 6)456
run on 2026-10-02 04:24 inside the library at commit 0e72e2e2c; taken from 788_section.ring(opens in a new tab)
# chars 1..6
? Q("NEXTAV TUNISIA").Section(:From = 1, :To = 6)NEXTAV
run on 2026-10-02 04:24 inside the library at commit 0e72e2e2c; taken from 521_section.ring(opens in a new tab)
Scope (8)
o1 = new stzString("123456789")
# -3 counts from the end
? o1.SectionXT(3, -3)34567
run on 2026-10-02 04:24 inside the library at commit 0e72e2e2c; taken from 405_sectionxt.ring(opens in a new tab)
o1 = new stzString("216;TUNISIA;227;NIGER")
# the field after the first ;
? o1.Section(5, o1.NextOccurrence( :Of = ";", :StartingAt = 5 ) - 1)TUNISIA
run on 2026-10-02 04:24 inside the library at commit 0e72e2e2c; taken from 698_section.ring(opens in a new tab)
o1 = new stzString("123456789")
# 5 to 3 reads backwards
? o1.SectionXT(5, 3)
# 5 with length 3 reads forward
? o1.SectionXT(5, -3)543 567
run on 2026-10-02 04:24 inside the library at commit 0e72e2e2c; taken from 986_sectionxt.ring(opens in a new tab)
o1 = new stzString("softanza")
# Section(4, 6) is 'tan'
? o1.Section(4, 6)
# Section(6, 4) auto-orders to the same
? o1.Section(6, 4)tan tan
run on 2026-10-02 04:23 inside the library at commit 0e72e2e2c; taken from 152_section.ring(opens in a new tab)
o1 = new stzString("12345678")
# Section(3, 5) spans positions 3..5
? o1.Section(3, 5)
# Section(5, 3) auto-orders to the same span
? o1.Section(5, 3)345 345
run on 2026-10-02 04:23 inside the library at commit 0e72e2e2c; taken from 18_section.ring(opens in a new tab)
o1 = new stzString("<<♥♥♥>>--<<stars>>--<<♥♥♥>>")
# BetweenIB(3, 5) is the heart run
? o1.BetweenIB(3, 5)
# Section(3, 5) gives the same
? o1.Section(3, 5)♥♥♥ ♥♥♥
run on 2026-10-02 04:23 inside the library at commit 0e72e2e2c; taken from 185_betweenib.ring(opens in a new tab)
# 4 mirrored is a single char
? Q("SOFTANZA").Section(4, :@)
# the 3rd-to-last mirrored
? Q("SOFTANZA").Section(:NthToLast = 3, :@)
# both mirrored is everything
? Q("SOFTANZA").Section(:@, :@)T A SOFTANZA
run on 2026-10-02 04:24 inside the library at commit 0e72e2e2c; taken from 523_section.ring(opens in a new tab)
o1 = new stzString("what a <<nice>>> day!")
# a single char
? o1.Section(3, 3)
# the word
? o1.Section(10, 13)
# reversed indexes auto-order
? o1.Section(13, 10)a nice nice
run on 2026-10-02 04:24 inside the library at commit 0e72e2e2c; taken from 531_section.ring(opens in a new tab)
and 9 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).
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
- The class stzString
- The area's reference: String
- The other methods in these examples: stzString.Between · stzString.Count · stzString.NumberOfChars · stzString.Replace · stzString.ReplaceAll · stzString.ReplaceFirst

