Under each method, its extensions (Q CS XT Z ZZ IB W U): bold and ticked, it exists; struck, it does not. The extensions and what they mean
Examples: 220 come from the library's tests; 586 were composed from each method's signature and run for this page, on a fresh object, for example o1 = new stzString("banana split"). 312 methods have none yet. Examples run on 2026-10-03 20:34 inside the library at commit 0e72e2e2c.
Method
Explanation, as the source carries it
operator
Haro's `obj[n]` syntax dispatches to operator("[]", n). For stzString we want the n-th codepoint (1-based). Negative n counts from the end: Q("ABCDE")[-1] = "E", [-2] = "D".no extension
init
Build the string object from the given Haro string.no extension
Override stzObject.Stringified/ToString. The parent returns ObjectName() (which is "@noname" for unnamed objects); stzString must return its actual content. Without this override, stzHashList.Classes() returned 4x "@noname" instead of the unique value labels.
6 examples runalso written: Text · AsWell · String · ToString · TheString · Stringified · DeepStringifiedin the section getting content of the stringo1 = new stzList([ 1, 2, 3 ])
? @@( o1 + Q(4) + 5 )
? @@( (o1 + Q("X" : "Z")).content() )
#--> [ 1, 2, 3, 4, 5 ]
#--> [ 1, 2, 3, [ "X", "Y", "Z" ] ]library testQCSXTZZZIBWUInfereType
Infer the canonical Softanza type named by this string. Used by the global InfereType(cType). Scalars collapse to :Number/:String/:Char (Stz-prefixed to :StzNumber/...); non-stz list/pair types collapse to the generic :List; stz-prefixed list types keep their (de-pluralised) canonical name (e.g. StzListsOfNumbers -> :StzListOfNumbers). Delegates to a file-scope helper: inside this class StartsWith / StzFind / StzReplaceCS resolve to stzString METHODS (wrong arity -> R20); at file scope they resolve to the global funcs.
composed example
o1 = new stzString("banana split")
? o1.InfereType()
#--> unknowncomposed from the signature, run for this page no extensionShow
Show -- print the content to stdout (terminated by NL). Convenience alias used by narrative tests of the form `o.Show()` instead of `? o.Content()`.QCSXTZZZIBWU
Display
Same as Show: print the content to stdout (terminated by NL). Convenience alias used by narrative tests of the form `o.Show()` instead of `? o.Content()`.no extension
Print
Same as Show: print the content to stdout (terminated by NL). Convenience alias used by narrative tests of the form `o.Show()` instead of `? o.Content()`.no extension
BoundsOf
BoundsOf(pcSub): the FLAT bound runs (left then right, per occurrence) of the occurrences bounded on BOTH sides -- per the original SubStringBoundsCS (Sections of the bound sections).QCSXTZZZIBWU
FirstBoundsOf
FirstBoundsOf / LastBoundsOf: just the left / right runs of the both-side-bounded occurrences.no extension
LastBoundsOf
(no comment in the source: the name reads as a sentence) last bounds ofin the section getting content of the stringno extension
BoundsOfFirstOccurrence
(no comment in the source: the name reads as a sentence) bounds of first occurrencein the section getting content of the stringno extension
BoundsOfUpToNChars
BoundsOfUpToNChars(pcSub, n): like BoundsOf but cap each PER-OCCURRENCE side at n chars (counted from the inside out). n can also be the list [nBefore, nAfter] for independent caps.no extension
BoundsOfXT3
(no comment in the source: the name reads as a sentence) bounds of xt3in the section getting content of the stringno extension
Engine
getting the engine handleno extension
The length of the string in characters (Unicode codepoints).
11 examples runalso named: length string length length of the string size how long count characters number of lettersalso written: Lengthostr = new stzString("s㊱m")
? ostr.NumberOfChars()
? ostr[2]
#--> 3
#--> ㊱library testQCSXTZZZIBWUHasMoreCharsThan
(no comment in the source: the name reads as a sentence) has more chars thanalso written: IsLarger · HasMoreChars · IsLargerThanalso accepted: HasMoreChars(3) · HasMoreChars(:Than = 3) · HasMoreChars(:Then = 3)in the section comparing size (number of chars)composed example
o1 = new stzString("banana split")
? o1.HasMoreCharsThan(3)
#--> 1composed from the signature, run for this page no extension HasLessCharsThan
(no comment in the source: the name reads as a sentence) has less chars thanalso written: IsSmaller · HasLessChars · HasFewerChars · IsSmallerThanalso accepted: HasLessChars(3) · HasLessChars(:Than = 3) · HasLessChars(:Then = 3)in the section comparing size (number of chars)composed example
o1 = new stzString("banana split")
? o1.HasLessCharsThan(3)
#--> 0composed from the signature, run for this page no extension IsEmpty
Whether the string has no characters.
also named: empty blank is empty no characters nothing void blank empty has nothing no characters is it emptycomposed example
o1 = new stzString("banana split")
? o1.IsEmpty()
#--> 0composed from the signature, run for this page no extensionIsAChar
TRUE if the string is exactly one char long.
also written: IsCharcomposed example
o1 = new stzString("banana split")
? o1.IsChar()
#--> 0composed from the signature, run for this page · written IsAChar() in the library today: the host language already holds IsChar(), and Haro removes the detour no extensiongetting a copy of the string object
2 examples runo2 = new stzString("R I N G")
# Copy().ReplaceQ() returns the changed copy
? o2.Copy().ReplaceQ(" ", "-").Content()
# the original is unchanged
? o2.Content()
#--> R-I-N-G
#--> R I N Glibrary testno extensionUpdate
updating the string content
composed example
o1 = new stzString("banana split")
o1.Update("AN")
? o1.Content()
#--> ANcomposed from the signature, run for this page QCSXTZZZIBWUUndoStack
updating the string contentno extension
NthChar
The char at position n (codepoint-aware).
also written: CharAtcomposed example
o1 = new stzString("banana split")
? o1.NthChar(2)
#--> acomposed from the signature, run for this page no extensionThe first char of the string (codepoint-aware).
2 examples runalso named: first character initial leading character opening charalso written: LeftCharo1 = new stzString("ABC")
# first
? o1.FirstChar()
# last
? o1.LastChar()
#--> A
#--> Clibrary testQCSXTZZZIBWUThe last char of the string (codepoint-aware).
2 examples runalso named: last character final char trailing character ending charalso written: RightCharo1 = new stzString("ABC")
# first
? o1.FirstChar()
# last
? o1.LastChar()
#--> A
#--> Clibrary testQCSXTZZZIBWUThe chars of the string, as a list (codepoint-aware).
3 examples runalso written: ToListOfCharsoAB = new stzString("ab")
big = new stzString( oAB.Repeated(1000000) )
oA = new stzString("a")
oBigA = new stzString( oA.Repeated(200000) )
# Chars() returns 200,000 single chars
? len(oBigA.Chars())
#--> 200000library testQCSXTZZZIBWUThe Unicode NAME of each char, as a list.
2 examples run? Q("◐◰☁").CharsNames()
#--> CIRCLE WITH LEFT HALF BLACK
#--> WHITE SQUARE WITH UPPER LEFT QUADRANT
#--> CLOUDlibrary testno extensionThe substring from position n1 to n2 (inclusive, codepoint-aware).
19 examples runalso named: substring slice part portion extract characters between two positionsalso written: Slice# 456
? StzStringQ("123456789").Section(4, 6)
#--> 456library testQCSXTZZZIBWUFirstHalf
FirstHalf / SecondHalf -- split the content in two equal halves (rounded down on odd length). FirstHalfXT returns trailing char.
composed example
o1 = new stzString("banana split")
? o1.FirstHalf()
#--> bananacomposed from the signature, run for this page QCSXTZZZIBWUSecondHalf
The second half of the string (the longer half when the length is odd).
composed example
o1 = new stzString("banana split")
? o1.SecondHalf()
#--> splitcomposed from the signature, run for this page QCSXTZZZIBWUHalves
Halves(): return [firstHalf, secondHalf] as a list of strings.
composed example
o1 = new stzString("banana split")
? @@( o1.Halves() )
#--> [ "banana", " split" ]composed from the signature, run for this page QCSXTZZZIBWUIsCircledNumber
IsCircledNumber / IsCircledDigit -- Unicode-aware single-char predicates (Enclosed Alphanumerics block etc.).
also written: IsCircledDigitcomposed example
o1 = new stzString("banana split")
? o1.IsCircledNumber()
#--> 0composed from the signature, run for this page no extensionReplace the chars at positions n1..n2 (inclusive) with pcNewSubStr. Ported from the legacy monolithic archive (~line 84916), kept minimal: pure numeric positions only. Symbolic forms (:First/:Last) are not yet supported.
5 examples runo1 = new stzString("123--67--")
o1.ReplaceSection(1, 3, "~")
# collapsed
? o1.Content()
#--> ~--67--library testQCSXTZZZIBWUSections
The substrings at the given [start, end] sections, as a list.QCSXTZZZIBWU
AntiSections
The substrings OUTSIDE the given sections, as a list.QCSXTZZZIBWU
FindAntiSections
The substrings between the occurrences of pcSubStr, as a list.
composed example
o1 = new stzString("banana split")
? @@( o1.FindAntiSections("an") )
#--> [ "b", "a split" ]composed from the signature, run for this page QCSXTZZZIBWUFindAsAntiSections
FindAsAntiSections: the complement [start, end] spans (the gaps around the occurrences), not the gap substrings.
composed example
o1 = new stzString("banana split")
? @@( o1.FindAsAntiSections("an") )
#--> [ [ 1, 1 ], [ 6, 12 ] ]composed from the signature, run for this page no extensionAntiFindAsSections
AntiFindAsSections: the complement POSITION sections (the gaps between occurrences), e.g. [[1,3],[8,10]] -- not the substrings.
composed example
o1 = new stzString("banana split")
? @@( o1.AntiFindAsSections("an") )
#--> [ [ 1, 1 ], [ 6, 12 ] ]composed from the signature, run for this page QCSXTZZZIBWURange
The substring starting at nStart and spanning nRange chars (lenient).
composed example
o1 = new stzString("banana split")
? o1.Range(2, 5)
#--> ananacomposed from the signature, run for this page no extensionIsLeftToRight
TRUE if the string runs left-to-right (bidi direction).
composed example
o1 = new stzString("banana split")
? o1.IsLeftToRight()
#--> 1composed from the signature, run for this page no extensionWhether the string contains the given substring.
13 examples runalso named: contain contains includes has contain a word is present occurs in includes has holds is there present in does it haveoS = new stzString("tea rice tea fish")
? oS.Contains("tea")
? oS.NumberOfOccurrence("tea")
? @@( oS.FindAll("tea") )
#--> 1
#--> 2
#--> [ 1, 10 ]library testQCSXTZZZIBWUSame as ExistsInListCS: List membership predicates: does this string appear as an item in the given list of strings? Ported from the legacy monolithic archive (~line 98300). Backs the natural-language chain "Q(str).IsOneOfThese([...])" and its aliases.
1 examples runalso written: IsOneOf · IsOneOfThe · IsOneOfThese · ExistsAsItemInList? StzListQ([ 3, 2, 5 ]).FindFirstOccurrence("2")
? StzListQ([ 3, 2, 5 ]).FindFirstOccurrence([ 2 ])
? StzListQ([ 3, 2, 5 ]).FindFirstOccurrence( 2 )
? Q(2).IsOneOfThese([ 3, 2, 5 ])
? Q("2").IsOneOfThese([ 3, 2, 5 ])
? Q([2]).IsOneOfThese([ 3, 2, 5 ])
#--> 0
#--> 0
#--> 2
#--> 1
#--> ...library testQCSXTZZZIBWUThe first occurrence of the substring: the position(s).
9 examples runalso written: FirstOccurrence · FindFirstSubString · FindFirstOccurrencecomposed example
o1 = new stzString("banana split")
? o1.FindFirst("an")
#--> 2composed from the signature, run for this page QCSXTZZZIBWUSTDSame as FindNextCS: FindNext: find the next occurrence of pcSubStr starting AFTER position nStart (so FindNext("x", 0) is equivalent to FindFirst). Ported from the legacy monolithic archive (~line 50328). Uses Haro's substr() with start-position support so it works for both case-sensitive and case-insensitive search without pulling in engine-level changes.
6 examples runalso written: FindNextSubStringo1 = new stzString("123456789")
# nothing at or after 10
? o1.FindNext("1", :startingAt = 10)
#--> 0library testQCSXTZZZIBWUST(no comment in the source: the name reads as a sentence) find next nth 2 examples runin the section essential find / contains / countcomposed example
o1 = new stzString("banana split")
? o1.FindNextNth(2, "an", 5)
#--> 0composed from the signature, run for this page QCSXTZZZIBWU NumbersComingAfter
Same as NumbersComingAfterCS: Numbers: extract every number literal embedded in the string as a list of strings, preserving signs and decimal points. Example: "book: 12.34, watch: -56.30, glasses: 77." -> [ "12.34", "-56.30", "77" ] Ported from the legacy monolithic archive (~line 100884) -- pure char-scan, self-contained, depends only on Chars(). Used by stzTimex.ParseDurationToMinutes() and is the #3 most-called missing method in the catalog. -- NumbersComingAfter: find every signed/decimal number literal that follows an occurrence of pcSubStr in the string. Returns a list of strings (the textual number forms incl. sign). Example: new stzString("This[@i-1] = This[@i+3]").NumbersComingAfter("@i") -> [ "-1", "+3" ] Ported from archive line 101153 but kept self-contained: manual scan instead of stzRegex + WithoutSpaces dependency. Used by stzCCode and friends.also written: NumbersAfterQCSXTZZZIBWU
NumberComingAfter
Same as NumberComingAfterCS: The FIRST number coming after the substring (NULL if none).QCSXTZZZIBWU
NumberAfter
Same as NumberComingAfterCS: The FIRST number coming after the substring (NULL if none).no extension
FirstNumberComingAfter
Same as NumberComingAfterCS: The FIRST number coming after the substring (NULL if none).no extension
ToListOfStzChars
Vowels: return the list of vowel chars in the string (ASCII a/e/i/o/u, case-insensitive). Ported from archive line 103163; self-contained byte scan. NumberOfVowels / VowelN are simple count aliases; VowelsB / HasVowels are predicates. Transform the chars of the string into a list of stzChar objects (each backed by stzStringChar via the alias).
composed example
o1 = new stzString("banana split")
? @@( o1.ToListOfStzChars() )
#--> [ @noname, @noname, @noname, @noname, @noname, @noname, @noname, @noname, @noname, @noname, @noname, @noname ]composed from the signature, run for this page no extensionHtmlEscaped
HtmlEscaped: escape `&`, `<`, `>`, `"`, `'` to HTML entities. Self-contained: no engine dependency, no external lookup.also written: HTMLEscape · EscapedHtmlno extension
ContainsInSection: does pcSubStr appear within the substring bounded by positions [n1, n2] (inclusive)?
3 examples runalso written: ContainsBetweenPositions# a caret after position 2
? Q("^^♥^^").ContainsXT("^", :AfterPosition = 2)
# a caret in the 5..3 span (normalized)
? Q("^^♥^^").ContainsInSection("^", 5, 3)
#--> 1
#--> 1library testQCSXTZZZIBWUReplaceInSection: replace occurrences of pSubStr within the section [n1, n2] with pNew. Polymorphic on argument order: ReplaceInSection(n1, n2, pSubStr, pNew) -- bounds first ReplaceInSection(pSubStr, pNew, n1, n2) -- substrings first
1 examples run# 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()
#--> [ [ 10, 20 ] ]
#--> Softanza PrograMMing by Heartlibrary testQCSXTZZZIBWUUppercaseSubString: uppercase a section or a named substring. Accepts: - UppercaseSubString(pcSub) : every occurrence - UppercaseSubString([n1, n2]) : 1-arg list form
1 examples runo1 = new stzString("Thank you Irwin Rodriguez!")
o1.UppercaseSubString("Irwin")
o1.AddXT( 2Hearts(), :Around = "IRWIN" )
# Irwin is uppercased and hearted
? o1.Content()
#--> Thank you ♥♥IRWIN♥♥ Rodriguez!library testQCSXTZZZIBWUShorten: truncate the content to the first N chars + "..." if it's longer than N. Defaults to N = 30. The "shorten the MIDDLE" family: keep N chars from each side and join them with an ellipsis. Shorten/ShortenN mutate; Shortened/ShortenedN return.
1 examples runcomposed example
o1 = new stzString("banana split")
o1.Shorten()
? o1.Content()
#--> ban...litcomposed from the signature, run for this page no extension(no comment in the source: the name reads as a sentence) shortened n 2 examples runin the section essential find / contains / count# ShortenedN(2) keeps 2 each side
? Q("1234567890987654321").ShortenedN(2)
# ShortenedXT(0,2,' {...} ') mirrors and uses the ellipsis
? Q("1234567890987654321").ShortenedXT(0, 2, " {...} ")
#--> 12...21
#--> 12 {...} 21library testno extension (no comment in the source: the name reads as a sentence) shortened 2 examples runin the section essential find / contains / count# Shortened() keeps 3 each side
? Q("1234567890987654321").Shortened()
# ShortenedN(5) keeps 5 each side
? Q("1234567890987654321").ShortenedN(5)
# ShortenedXT(0,3,' ... ') mirrors with a custom ellipsis
? Q("1234567890987654321").ShortenedXT(0, 3, " ... ")
#--> 123...321
#--> 12345...54321
#--> 123 ... 321library testQCSXTZZZIBWU ShortenedUsing(pcEllipsis): keep first+last 3 chars, glued with the ellipsis.
1 examples run# ShortenedUsing(' {...} ') keeps 3 each side
? Q("1234567890987654321").ShortenedUsing(" {...} ")
# ShortenedNUsing(5, ' {...} ') keeps 5 each side
? Q("1234567890987654321").ShortenedNUsing(5, " {...} ")
#--> 123 {...} 321
#--> 12345 {...} 54321library testQCSXTZZZIBWUBoxify
Boxify: surround the content with the Softanza box -- the SAME box-drawing glyphs as tables, grids, timelines and calendars (the VISUALITY design system; never plain +/- bars). Returns the boxed string; the content-mutating form is Box()/BoxXT().
composed example
o1 = new stzString("banana split")
? o1.Boxify()
#--> ┌──────────────┐
#--> │ banana split │
#--> └──────────────┘composed from the signature, run for this page no extensionVowels
(no comment in the source: the name reads as a sentence) vowelsin the section essential find / contains / countcomposed example
o1 = new stzString("banana split")
? @@( o1.Vowels() )
#--> [ "a", "a", "a", "i" ]composed from the signature, run for this page no extension Extend / ExtendXT: append content / pad to length / pad to position. Port from archive line 3596 (the DSL variant) plus the simpler positional cases.
6 examples runcomposed example
o1 = new stzString("banana split")
o1.Extend("x")
? o1.Content()
#--> banana splitxcomposed from the signature, run for this page QCSXTZZZIBWU(no comment in the source: the name reads as a sentence) extend with 1 examples runin the section essential find / contains / counto1 = new stzString("ABC")
o1.ExtendWith("DE")
# the content is now ABCDE
? o1.Content()
#--> ABCDElibrary testQCSXTZZZIBWU ExtendToPosition
(no comment in the source: the name reads as a sentence) extend to positionin the section essential find / contains / countQCSXTZZZIBWU
ExtendToPositionWith
(no comment in the source: the name reads as a sentence) extend to position within the section essential find / contains / countQCSXTZZZIBWU
RandomChar
Return a random char from the string content. Uniform random choice across char positions.also written: AChar · AnyChar · ARandomCharno extension
FindNumbersAsSections
FindNumbersAsSections: for each number found in the content, return a [start, end] pair (1-based byte positions). Used by stzListRandom.RandomizeNumbers and friends.no extension
NumberOfVowels
(no comment in the source: the name reads as a sentence) number of vowelsalso written: VowelN · CountVowelsin the section essential find / contains / countcomposed example
o1 = new stzString("banana split")
? o1.NumberOfVowels()
#--> 4composed from the signature, run for this page no extension VowelNB
(no comment in the source: the name reads as a sentence) vowel nbin the section essential find / contains / countcomposed example
o1 = new stzString("banana split")
? o1.VowelNB()
#--> 0composed from the signature, run for this page no extension IsVowel
Returns 1 if the string is a single vowel char (case-insensitive ASCII a/e/i/o/u). Convenience predicate; callers use it as `Q(c).IsVowel()` or `Q(c).Vowel()`.
also written: Vowelcomposed example
o1 = new stzString("banana split")
? o1.IsVowel()
#--> 0composed from the signature, run for this page no extensionHasVowels
(no comment in the source: the name reads as a sentence) has vowelsalso written: ContainsVowelsin the section essential find / contains / countcomposed example
o1 = new stzString("banana split")
? o1.HasVowels()
#--> 1composed from the signature, run for this page no extension (no comment in the source: the name reads as a sentence) vowels b 1 examples runin the section essential find / contains / countcomposed example
o1 = new stzString("banana split")
? o1.VowelsB()
#--> 0composed from the signature, run for this page no extension (no comment in the source: the name reads as a sentence) numbers 1 examples runin the section essential find / contains / count? rx("[0-9]+").Match("24/09/2026")
? rx("[0-9]+").MatchFirst("24/09/2026")
? @@( Q("tea 12, rice 30").Numbers() )
#--> 0
#--> 1
#--> [ "12", "30" ]library testQCSXTZZZIBWU SumOfNumbers
Data extraction: total amounts in an invoice/log, averages, ranges. A number = optional '-', digits, one optional '.' with more digits.
composed example
o1 = new stzString("banana split")
? o1.SumOfNumbers()
#--> 0composed from the signature, run for this page no extensionCountNumbers
(no comment in the source: the name reads as a sentence) count numbersin the section essential find / contains / countcomposed example
o1 = new stzString("banana split")
? o1.CountNumbers()
#--> 0composed from the signature, run for this page no extension MinNumber
(no comment in the source: the name reads as a sentence) min numberin the section essential find / contains / countcomposed example
o1 = new stzString("banana split")
? o1.MinNumber()
#--> 0composed from the signature, run for this page no extension MaxNumber
(no comment in the source: the name reads as a sentence) max numberin the section essential find / contains / countcomposed example
o1 = new stzString("banana split")
? o1.MaxNumber()
#--> 0composed from the signature, run for this page no extension AverageOfNumbers
(no comment in the source: the name reads as a sentence) average of numbersalso written: MeanOfNumbersin the section essential find / contains / countcomposed example
o1 = new stzString("banana split")
? o1.AverageOfNumbers()
#--> 0composed from the signature, run for this page no extension (no comment in the source: the name reads as a sentence) number of occurrence 2 examples runin the section essential find / contains / countoS = new stzString("tea rice tea fish")
? oS.Contains("tea")
? oS.NumberOfOccurrence("tea")
? @@( oS.FindAll("tea") )
#--> 1
#--> 2
#--> [ 1, 10 ]library testQCSXTZZZIBWU Find pcSubStr in the string: the positions of EVERY occurrence, as a list (engine-backed, codepoint-aware). (case-sensitive by default)
6 examples runalso named: locate search for position of index of where isalso written: FindAll · FindSubStringoS = new stzString("tea rice tea fish")
? oS.Contains("tea")
? oS.NumberOfOccurrence("tea")
? @@( oS.FindAll("tea") )
#--> 1
#--> 2
#--> [ 1, 10 ]library testQCSXTZZZIBWUSTDManyExceptFindInSection
Same as FindInSectionCS: FindInSection: find occurrences of pcSubStr restricted to the character range [n1, n2]. Returns positions in the FULL string (not relative to the section). No match -> [].
also written: FindAllInSectioncomposed example
o1 = new stzString("banana split")
? @@( o1.FindInSection("an", 2, 5) )
#--> [ 2, 4 ]composed from the signature, run for this page QCSXTZZZIBWUfind all / find nth
9 examples runcomposed example
o1 = new stzString("banana split")
? o1.FindNth(2, "an")
#--> 4composed from the signature, run for this page QCSXTZZZIBWUSTDThe last occurrence of the substring: the position(s).
9 examples runo1 = new stzString("•♥••••♥••")
# FindLast('♥') is 7
? o1.FindLast("♥")
# FindLast('_') (absent) is 0
? o1.FindLast("_")
#--> 7
#--> 0library testQCSXTZZZIBWUSTDStartsWith
Whether the string starts with the given prefix.
also named: starts with begins with prefix leading has prefix begins with prefix at the start opens withcomposed example
o1 = new stzString("banana split")
? o1.StartsWith("an")
#--> 0composed from the signature, run for this page QCSXTZZZIBWUWhether the string ends with the given suffix.
1 examples runalso named: ends with finishes with suffix trailing has suffix finishes with suffix at the end closes withcomposed example
o1 = new stzString("banana split")
? o1.EndsWith("an")
#--> 0composed from the signature, run for this page QCSXTZZZIBWUPredicates: does the string end with / start with a numeric character (0-9)? Ported from the legacy monolithic archive (line 100803) but kept self-contained -- no dependency on stzChar.IsANumber. Used by stzGlobal feature detection.
3 examples runalso written: EndsWithNumber · ContainsAFinalNumber · EndsWithAFinalNumber · ContainsAnEndingNumber · ContainsATrailingNumber · EndsWithATrailingNumbercomposed example
o1 = new stzString("banana split")
? o1.EndsWithANumber()
#--> 0composed from the signature, run for this page no extensionstarts with / ends with
1 examples runalso written: StartsWithNumber · StartsWithALeadingNumbercomposed example
o1 = new stzString("banana split")
? o1.StartsWithANumber()
#--> 0composed from the signature, run for this page no extensionUppercase
Change the string to UPPER CASE in place (mutating). For a copy, use Uppercased.
composed example
o1 = new stzString("banana split")
o1.Uppercase()
? o1.Content()
#--> BANANA SPLITcomposed from the signature, run for this page QCSXTZZZIBWUAn UPPER CASE (all capitals) copy of the string; the original is unchanged.
3 examples runalso named: upper case capitals all caps in capitals# lowercased
? Q("tunis").Lowercased()
# uppercased
? Q("tunis").Uppercased()
# titlecased
? Q("tunis").Titlecased()
#--> tunis
#--> TUNIS
#--> Tunislibrary testno extensionLowercase
Change the string to lower case in place (mutating). For a copy, use Lowercased.QCSXTZZZIBWU
InLowercase
Misspelled but historically-used aliasesalso written: InLowarcaseQCSXTZZZIBWU
A lower case copy of the string; the original is unchanged.
7 examples runalso named: lower case small letters in lowercase? Q("ABC") * 3
? ( Q("ABC") * Q(3) ).StzType() + NL
? ( Q("ABC") * Q(3) ).Lowercased()
? Q("ABC") * " -> "
? ( Q("ABC") * Q(" -> ") ).Lowercased()
#--> ABCABCABC
#--> stzstring
#--> abcabcabc
#--> A -> B -> C ->
#--> ...library testno extensionCapitalize
Capitalize the first letter in place (mutating). For a copy, use Capitalized.
composed example
o1 = new stzString("banana split")
o1.Capitalize()
? o1.Content()
#--> Banana splitcomposed from the signature, run for this page QCSXTZZZIBWUCapitalized
A copy with the first letter capitalized (title-style); original unchanged.
also named: title case first letter capital sentence case proper casecomposed example
o1 = new stzString("banana split")
? o1.Capitalized()
#--> Banana splitcomposed from the signature, run for this page no extensionReverse
Reverse the order of the characters in the string, in place (mutating). For a copy that leaves the original unchanged, use Reversed.
composed example
o1 = new stzString("banana split")
o1.Reverse()
? o1.Content()
#--> tilps ananabcomposed from the signature, run for this page QCSXTZZZIBWUA copy of the string with the characters in reverse order; original unchanged.
3 examples runalso named: backwards in reverse order mirrored flipped# digits flip
? Q("9876543210").Reversed()
#--> 0123456789library testno extensionReplace every occurrence of a substring with another.
22 examples runalso named: replace substitute swap text find and replace change all rename substitute swap change find and replace put insteado1 = new stzString("R I N G")
o1.Replace(" ", "-")
# Replace() mutates the object
? o1.Content()
#--> R-I-N-Glibrary testQCSXTZZZIBWUManySame as Replace: replace every occurrence of pcSubStr (mutating).
7 examples runo1 = new stzString("one two three four")
o1.ReplaceAll("two", "---")
# two became dashes
? o1.Content()
#--> one --- three fourlibrary testQCSXTZZZIBWUExceptSame as ReplacedCS: A copy with every occurrence of pcSubStr replaced by pcNewSubStr; the original is unchanged.
1 examples run? Q("tea, rice, tea").Replaced("tea", :With = "coffee")
#--> coffee, rice, coffeelibrary testQCSXTZZZIBWURemove every occurrence of pcSubStr from the string (mutating). For a copy, use Removed.
26 examples runalso named: delete erase take out strip dropcomposed example
o1 = new stzString("banana split")
o1.Remove("an")
? o1.Content()
#--> ba splitcomposed from the signature, run for this page QCSXTZZZIBWUManyRemoveAll
Same as Remove: remove every occurrence of pcSubStr (mutating).
also named: delete strip erase get rid of take out dropcomposed example
o1 = new stzString("banana split")
o1.RemoveAll("an")
? o1.Content()
#--> ba splitcomposed from the signature, run for this page QCSXTZZZIBWUExceptReplaceNth
(no comment in the source: the name reads as a sentence) replace nthin the section replace nth / first / lastcomposed example
o1 = new stzString("banana split")
o1.ReplaceNth(2, "an", "AN")
? o1.Content()
#--> banANa splitcomposed from the signature, run for this page QCSXTZZZIBWU (no comment in the source: the name reads as a sentence) replace first 2 examples runin the section replace nth / first / lastcomposed example
o1 = new stzString("banana split")
o1.ReplaceFirst("an", "AN")
? o1.Content()
#--> bANana splitcomposed from the signature, run for this page QCSXTZZZIBWU ReplaceLast
(no comment in the source: the name reads as a sentence) replace lastin the section replace nth / first / lastcomposed example
o1 = new stzString("banana split")
o1.ReplaceLast("an", "AN")
? o1.Content()
#--> banANa splitcomposed from the signature, run for this page QCSXTZZZIBWU (no comment in the source: the name reads as a sentence) replace by many 3 examples runin the section replace nth / first / lasto1 = new stzString("--*--*--*--")
o1.ReplaceByMany("*", [ "ONE", "TWO", :And = "THREE" ])
# one word per star
? o1.Content()
#--> --ONE--TWO--THREE--library testQCSXTZZZIBWU ReplaceSubStringsBoundedBy(pacBounds, pcNew): replace every substring sitting BETWEEN the bounds (exclusive of the bounds themselves) with pcNew. pacBounds can be ["open", "close"] or a single string used for both ends.
1 examples runo1 = new stzString("bla bla <<word>> bla bla <<noword>> bla <<wording>>")
o1.ReplaceSubStringsBoundedBy([ "<<", ">>" ], "wrod")
# all three regions now hold wrod
? o1.Content()
#--> bla bla <<wrod>> bla bla <<wrod>> bla <<wrod>>library testQCSXTZZZIBWUReplaceSubStringBoundedBy(pcWhat, pacBounds, pcNew): replace pcWhat with pcNew only when it sits inside a bounded section. pacBounds may be ["open","close"] OR a single string used both ways. ReplaceSubStringBoundedBy(pcWhat, bounds, :With = new): replace the occurrences of pcWhat that ARE a whole bounded region's content (the same equality contract as FindSubStringBoundedBy; same-string bounds pair with the overlap walk).
3 examples runQCSXTZZZIBWUReplaceSubStringAtPosition
ReplaceSubStringAtPosition(n, pcOld, pcNew): replace pcOld with pcNew only at character position n (so pcOld must start at n).
composed example
o1 = new stzString("banana split")
o1.ReplaceSubStringAtPosition(2, "an", "AN")
? o1.Content()
#--> bANana splitcomposed from the signature, run for this page QCSXTZZZIBWUReplaceAt
ReplaceAt(n, pcOld, pcNew) -- replace pcOld at position n with pcNew ReplaceAt(anPos, pcOld, :By = pcNew) -- list-of-positions form Haro's strict arity means the single-char form lives at ReplaceCharAt(n, pcNewChar) (positional or named-param). Three-arg signature -- callers using the 2-arg form should use ReplaceCharAt.
composed example
o1 = new stzString("banana split")
o1.ReplaceAt(2, "an", "AN")
? o1.Content()
#--> bANana splitcomposed from the signature, run for this page QCSXTZZZIBWUReplaceCharAt(:Position = n, :By = pcNew) -- named-param variant of ReplaceAt for char-at-position replacement.
2 examples runo1 = new stzString("ABC*EF")
o1.ReplaceCharAt(:Position = 4, :By = "D")
# the star became D
? o1.Content()
#--> ABCDEFlibrary testQCSXTZZZIBWUReplaceCharAtSimple
ReplaceCharAt(n, pcNew) -- single-char-at-position form. (Named-param :Position/:By form lives at ReplaceCharAt2 above.)
composed example
o1 = new stzString("banana split")
o1.ReplaceCharAtSimple(2, "AN")
? o1.Content()
#--> bANnana splitcomposed from the signature, run for this page no extensionReplaceCharsAtPositions(anPos, :With/:By = pcNewChar) -- replace the char at each listed position with pcNewChar.
1 examples runo1 = new stzString("AB3CD6EF9GH")
o1.ReplaceCharsAtPositions([ 3, 9, 6 ], Heart())
# all three replaced
? o1.Content()
#--> AB♥CD♥EF♥GHlibrary testQCSXTZZZIBWUReplaceCharsAtPositionsByMany(anPos, paChars): per-position parallel replacement -- position anPos[i] gets replaced by paChars[i] (cycling if there are more positions than chars).
1 examples runo1 = new stzString("ab3de6gh9")
o1.ReplaceCharsAtPositionsByMany([3, 6, 9], [ "c", "f", "i" ])
# the alphabet restored
? o1.Content()
#--> abcdefghilibrary testQCSXTZZZIBWUSit
Sit(:OnSection = [n1, n2], :AndHarvest = [:NCharsBefore=a, :NCharsAfter=b]) -- "sit on a section" and harvest a chars to the left + b chars to the right of it. Returns [cLeft, cRight]. Sit(:OnSection = [n1,n2] / :OnPosition = n, :AndHarvest = [...] / :AndHarvestSections = [...]): sit on a section (or single position) and harvest what's around it. Harvest specs: :NCharsBefore / :NCharsAfter (fixed counts) and :CharsBeforeW / :CharsAfterW (the run of chars satisfying a W predicate). The Sections variant returns the [start, end] spans instead of the substrings.no extension
Markers
Markers(): return the list of marker numbers as they appear, left-to-right. e.g. "#1 #3 #2" -> [1, 3, 2].QCSXTZZZIBWU
Marquers
Marquers() returns the "#N" STRINGS (the numeric-only view stays in Markers(), which the sorting checks use).QCSXTZZZIBWU
(no comment in the source: the name reads as a sentence) number of markers 1 examples runalso written: NumberOfMarquersin the section replace nth / first / lastcomposed example
o1 = new stzString("banana split")
? o1.NumberOfMarkers()
#--> 0composed from the signature, run for this page no extension (no comment in the source: the name reads as a sentence) markers are sorted in ascending 1 examples runalso written: MarkersAreSortedAscending · MarquersAreSortedInAscendingin the section replace nth / first / last# 1-2-3 ascends
? Q("My name is #1, my age is #2, and my job is #3.").MarquersAreSortedInAscending()
# 2-1-3 does not
? Q("My name is #2, my age is #1, and my job is #3.").MarquersAreSortedInAscending()
#--> 1
#--> 0library testno extension (no comment in the source: the name reads as a sentence) markers are sorted in descending 1 examples runalso written: MarquersAreSortedInDescendingin the section replace nth / first / last# 3-2-1 descends
? Q("My name is #3, my age is #2, and my job is #1.").MarquersAreSortedIndescending()
# 2-1-3 does not
? Q("My name is #2, my age is #1, and my job is #3.").MarquersAreSortedInDescending()
#--> 1
#--> 0library testno extension (no comment in the source: the name reads as a sentence) markers are sorted 2 examples runalso written: MarquersAreSortedin the section replace nth / first / lasto1 = new stzString("My name is #1, my age is #2, and my job is #3.")
# they are sorted
? o1.MarquersAreSorted()
# ... ascending
? o1.MarquersSortingOrder()
#--> 1
#--> ascendinglibrary testno extension MarkersAreUnsorted: TRUE when markers don't all monotone.
1 examples runalso written: MarquersAreUnsortedo1 = new stzString("My name is #1, my age is #3, and my job is #2.")
# they are unsorted
? o1.MarquersAreUnsorted()
# the order says so
? o1.MarquersSortingOrder()
#--> 1
#--> unsortedlibrary testno extensionSpacifyChars / SpacifyCharsUsing / SpacifyCharsXT -- char-wise Spacify variants: insert a separator between every pair of consecutive chars (with optional step + direction).
3 examples runo1 = new stzString("99999999999")
o1.SpacifyChars()
# a space is inserted between every 9
? o1.Content()
#--> 9 9 9 9 9 9 9 9 9 9 9library testQCSXTZZZIBWUSpacify: shorter spelling -- same as SpacifyChars.
11 examples run# four carets, doubled gaps
? Q("ABTCADNBBABEFACCC").SpacifyQ().vizFind("A")
#--> A B T C A D N B B A B E F A C C C
#--> ^-------^---------^-------^------library testQCSXTZZZIBWUSpacifyUsing
SpacifyUsing: alias of SpacifyCharsUsing.QCSXTZZZIBWU
(no comment in the source: the name reads as a sentence) spacify chars using 1 examples runin the section replace nth / first / lasto1 = new stzString("SOFTANZA")
o1.SpacifyCharsUsing("~")
# tilde-joined
? o1.Content()
#--> S~O~F~T~A~N~Z~Alibrary testQCSXTZZZIBWU (no comment in the source: the name reads as a sentence) remove first 1 examples runin the section remove first / lasto1 = new stzString("**A1****A2***A3")
o1.RemoveFirst("A")
# the first A is gone
? o1.Content()
#--> **1****A2***A3library testQCSXTZZZIBWU (no comment in the source: the name reads as a sentence) remove last 2 examples runin the section remove first / lasto1 = new stzString("**A1****A2***A3")
o1.RemoveLast("A")
# the third A is gone
? o1.Content()
#--> **A1****A2***3library testQCSXTZZZIBWU Insert pcSubStr BEFORE position n -- or before the given anchor substring (mutating).
3 examples runalso named: put before prepend at inject ahead ofo1 = new stzString("123456789")
o1.InsertBefore([4, 7], "_")
# underscores land before positions 4 and 7
? o1.Content()
#--> 123_456_789library testQCSXTZZZIBWUInsertBeforePosition
Same as InsertBefore: Insert pcSubStr BEFORE position n -- or before the given anchor substring (mutating).
composed example
o1 = new stzString("banana split")
o1.InsertBeforePosition(2, "an")
? o1.Content()
#--> bananana splitcomposed from the signature, run for this page no extensionExtendToWith(n, pcChar): pad the string out to total length n by appending copies of pcChar at the end.
1 examples runo1 = new stzString("ABC")
o1.ExtendToWith(5, "*")
# 'ABC' padded to width 5 with '*'
? o1.Content()
#--> ABC**library testQCSXTZZZIBWUPad the string to total length n by cycling its own chars (mutating).
1 examples runo1 = new stzString("123")
o1.ExtendToWithCharsRepeated(8)
# '123' repeated up to width 8
? o1.Content()
#--> 12312312library testQCSXTZZZIBWUPad the string to total length n by cycling the given chars or range (mutating).
1 examples runo1 = new stzString("123")
o1.ExtendToWithCharsIn( 8, "1":"3" )
# it grows to length 8 by cycling 1,2,3
? o1.Content()
#--> 12312312library testQCSXTZZZIBWURemoveCharsWXT(pcCondition): remove every char where the predicate is TRUE. Predicate runs with @char bound.
6 examples runcomposed example
o1 = new stzString("banana split")
o1.RemoveCharsW("@char = 'a'")
? o1.Content()
#--> bnn splitcomposed from the signature, run for this page QCSXTZZZIBWURemoveDuplicatedChars
RemoveDuplicatedChars: dedup chars in-place (keep first occurrence).
composed example
o1 = new stzString("banana split")
o1.RemoveDuplicatedChars()
? o1.Content()
#--> ban splitcomposed from the signature, run for this page QCSXTZZZIBWURemoveDupChars
Same as RemoveDuplicatedChars: RemoveDuplicatedChars: dedup chars in-place (keep first occurrence).
composed example
o1 = new stzString("banana split")
o1.RemoveDupChars()
? o1.Content()
#--> ban splitcomposed from the signature, run for this page QCSXTZZZIBWUInsertAt
Same as InsertBefore: Insert pcSubStr BEFORE position n -- or before the given anchor substring (mutating).
composed example
o1 = new stzString("banana split")
o1.InsertAt(2, "an")
? o1.Content()
#--> bananana splitcomposed from the signature, run for this page QCSXTZZZIBWUInsert pcSubStr AFTER position n -- or after the given anchor substring (mutating).
1 examples runcomposed example
o1 = new stzString("banana split")
o1.InsertAfter(2, "an")
? o1.Content()
#--> baannana splitcomposed from the signature, run for this page QCSXTZZZIBWUInsertAfterPosition
Same as InsertAfter: Insert pcSubStr AFTER position n -- or after the given anchor substring (mutating).
composed example
o1 = new stzString("banana split")
o1.InsertAfterPosition(2, "an")
? o1.Content()
#--> baannana splitcomposed from the signature, run for this page no extensionInsertAfterPositions(anPos, pcStr): insert pcStr after each position in anPos. Walk descending so earlier positions stay valid as later inserts shift the string.
2 examples runo1 = new stzString("SOFTANZA")
o1.InsertAfterPositions([ 2, 4, 6, 8 ], " ")
# pairs, no trailing space
? o1.Content()
#--> SO FT AN ZAlibrary testQCSXTZZZIBWUInsertBeforePositions: mirror. Insert pcStr before EACH of the given positions (mutating).
1 examples runo1 = new stzString("SOFTANZA")
o1.InsertBeforePositions([ 2, 4, 6, 8 ], " ")
# split look
? o1.Content()
#--> S OF TA NZ Alibrary testQCSXTZZZIBWUInsertAfterEachNChars
InsertAfterEachNChars(n, pcStr) -- insert pcStr after every n characters, walking from start by default. :StartingFrom = :End walks from the right.
composed example
o1 = new stzString("banana split")
o1.InsertAfterEachNChars(2, "an")
? o1.Content()
#--> baannaannaan sanplanitcomposed from the signature, run for this page QCSXTZZZIBWUThe words of the string, as a list (whitespace-split by design).
1 examples runcomposed example
o1 = new stzString("banana split")
? @@( o1.Words() )
#--> [ "banana", "split" ]composed from the signature, run for this page QCSXTZZZIBWUQQHow many words the string holds.
1 examples runalso named: word count how many words count the wordsalso written: CountWords · HowManyWordso1 = new stzString("the bread was cold and the tea was cold")
? o1.NumberOfWords()
#--> 9library testno extensionStemmedInLanguage
(no comment in the source: the name reads as a sentence) stemmed in languagein the section text-meaning domain (stztext, base/natural/)no extension
Stemmed
(no comment in the source: the name reads as a sentence) stemmedalso written: Stemin the section text-meaning domain (stztext, base/natural/)no extension
StemmedWordsInLanguage
(no comment in the source: the name reads as a sentence) stemmed words in languagein the section text-meaning domain (stztext, base/natural/)composed example
o1 = new stzString("banana split")
? @@( o1.StemmedWordsInLanguage("en") )
#--> [ "banana", "split" ]composed from the signature, run for this page no extension StemmedWords
(no comment in the source: the name reads as a sentence) stemmed wordsalso written: WordsStemmedin the section text-meaning domain (stztext, base/natural/)composed example
o1 = new stzString("banana split")
? @@( o1.StemmedWords() )
#--> [ "banana", "split" ]composed from the signature, run for this page no extension (no comment in the source: the name reads as a sentence) supported stemmer languages 1 examples runin the section text-meaning domain (stztext, base/natural/)no extension SupportedLemmaLanguages
(no comment in the source: the name reads as a sentence) supported lemma languagesin the section text-meaning domain (stztext, base/natural/)composed example
o1 = new stzString("banana split")
? @@( o1.SupportedLemmaLanguages() )
#--> [ "english", "french", "arabic" ]composed from the signature, run for this page no extension (no comment in the source: the name reads as a sentence) synonyms 1 examples runin the section text-meaning domain (stztext, base/natural/)QCSXTZZZIBWUQQ (no comment in the source: the name reads as a sentence) hypernyms 1 examples runin the section text-meaning domain (stztext, base/natural/)composed example
o1 = new stzString("banana split")
? @@( o1.Hypernyms() )
#--> [ "split" ]composed from the signature, run for this page QCSXTZZZIBWUQQ (no comment in the source: the name reads as a sentence) is synonym of 1 examples runin the section text-meaning domain (stztext, base/natural/)composed example
o1 = new stzString("banana split")
? o1.IsSynonymOf("an")
#--> 0composed from the signature, run for this page no extension HasSynonyms
(no comment in the source: the name reads as a sentence) has synonymsin the section text-meaning domain (stztext, base/natural/)composed example
o1 = new stzString("banana split")
? o1.HasSynonyms()
#--> 0composed from the signature, run for this page no extension LemmatizedInLanguage
(no comment in the source: the name reads as a sentence) lemmatized in languagein the section text-meaning domain (stztext, base/natural/)no extension
Lemmatized
(no comment in the source: the name reads as a sentence) lemmatizedalso written: Lemmain the section text-meaning domain (stztext, base/natural/)no extension
LemmatizedWordsInLanguage
(no comment in the source: the name reads as a sentence) lemmatized words in languagein the section text-meaning domain (stztext, base/natural/)composed example
o1 = new stzString("banana split")
? @@( o1.LemmatizedWordsInLanguage("en") )
#--> [ "banana", "split" ]composed from the signature, run for this page no extension LemmatizedWords
(no comment in the source: the name reads as a sentence) lemmatized wordsalso written: WordsLemmatizedin the section text-meaning domain (stztext, base/natural/)composed example
o1 = new stzString("banana split")
? @@( o1.LemmatizedWords() )
#--> [ "banana", "split" ]composed from the signature, run for this page no extension SentimentScore
(no comment in the source: the name reads as a sentence) sentiment scorealso written: SentimentCompoundin the section text-meaning domain (stztext, base/natural/)composed example
o1 = new stzString("banana split")
? o1.SentimentScore()
#--> 0composed from the signature, run for this page no extension (no comment in the source: the name reads as a sentence) sentiment 1 examples runin the section text-meaning domain (stztext, base/natural/)composed example
o1 = new stzString("banana split")
? o1.Sentiment()
#--> neutralcomposed from the signature, run for this page no extension PositiveScore
(no comment in the source: the name reads as a sentence) positive scorein the section text-meaning domain (stztext, base/natural/)composed example
o1 = new stzString("banana split")
? o1.PositiveScore()
#--> 0composed from the signature, run for this page no extension NegativeScore
(no comment in the source: the name reads as a sentence) negative scorein the section text-meaning domain (stztext, base/natural/)composed example
o1 = new stzString("banana split")
? o1.NegativeScore()
#--> 0composed from the signature, run for this page no extension NeutralScore
(no comment in the source: the name reads as a sentence) neutral scorein the section text-meaning domain (stztext, base/natural/)composed example
o1 = new stzString("banana split")
? o1.NeutralScore()
#--> 1composed from the signature, run for this page no extension IsPositive
(no comment in the source: the name reads as a sentence) is positivein the section text-meaning domain (stztext, base/natural/)composed example
o1 = new stzString("banana split")
? o1.IsPositive()
#--> 0composed from the signature, run for this page no extension IsNegative
(no comment in the source: the name reads as a sentence) is negativein the section text-meaning domain (stztext, base/natural/)composed example
o1 = new stzString("banana split")
? o1.IsNegative()
#--> 0composed from the signature, run for this page no extension POSTags
The part-of-speech tag of each word (via the text layer).
also written: PartOfSpeechTagscomposed example
o1 = new stzString("banana split")
? @@( o1.POSTags() )
#--> [ "NN", "NN" ]composed from the signature, run for this page no extensionTaggedWords
(no comment in the source: the name reads as a sentence) tagged wordsalso written: WordsWithPOSin the section text-meaning domain (stztext, base/natural/)composed example
o1 = new stzString("banana split")
? @@( o1.TaggedWords() )
#--> [ [ "banana", "NN" ], [ "split", "NN" ] ]composed from the signature, run for this page no extension NamedEntities
The named entities found in the string (via the text layer).also written: Entitiesno extension
EntitiesOfType
(no comment in the source: the name reads as a sentence) entities of typein the section text-meaning domain (stztext, base/natural/)no extension
PersonNames
(no comment in the source: the name reads as a sentence) person namesin the section text-meaning domain (stztext, base/natural/)no extension
Organizations
(no comment in the source: the name reads as a sentence) organizationsin the section text-meaning domain (stztext, base/natural/)no extension
Locations
(no comment in the source: the name reads as a sentence) locationsin the section text-meaning domain (stztext, base/natural/)no extension
ContentWords
(no comment in the source: the name reads as a sentence) content wordsalso written: Keywordsin the section text-meaning domain (stztext, base/natural/)composed example
o1 = new stzString("banana split")
? @@( o1.ContentWords() )
#--> [ "banana", "split" ]composed from the signature, run for this page no extension WithoutStopwords
(no comment in the source: the name reads as a sentence) without stopwordsin the section text-meaning domain (stztext, base/natural/)no extension
IsStopword
(no comment in the source: the name reads as a sentence) is stopwordin the section text-meaning domain (stztext, base/natural/)composed example
o1 = new stzString("banana split")
? o1.IsStopword()
#--> 0composed from the signature, run for this page no extension ReadingEase
The Flesch reading-ease score of the string (via the text layer).also written: FleschReadingEaseno extension
ReadabilityGrade
(no comment in the source: the name reads as a sentence) readability gradealso written: FleschKincaidGradein the section text-meaning domain (stztext, base/natural/)composed example
o1 = new stzString("banana split")
? o1.FleschKincaidGrade()
#--> 8.79composed from the signature, run for this page no extension (no comment in the source: the name reads as a sentence) key phrases 1 examples runin the section text-meaning domain (stztext, base/natural/)composed example
o1 = new stzString("banana split")
? @@( o1.KeyPhrases(2) )
#--> [ "banana split" ]composed from the signature, run for this page QCSXTZZZIBWUQQ (no comment in the source: the name reads as a sentence) top key phrase 1 examples runin the section text-meaning domain (stztext, base/natural/)no extension (no comment in the source: the name reads as a sentence) ranked keywords 1 examples runin the section text-meaning domain (stztext, base/natural/)composed example
o1 = new stzString("banana split")
? @@( o1.RankedKeywords(2) )
#--> [ "banana", "split" ]composed from the signature, run for this page QCSXTZZZIBWUQQ (no comment in the source: the name reads as a sentence) summary sentences 1 examples runin the section text-meaning domain (stztext, base/natural/)composed example
o1 = new stzString("banana split")
? @@( o1.SummarySentences(2) )
#--> [ "banana split" ]composed from the signature, run for this page QCSXTZZZIBWUQQ (no comment in the source: the name reads as a sentence) summarized in 1 examples runalso written: Summaryin the section text-meaning domain (stztext, base/natural/)no extension WordsForSearch
Like Words() but CJK runs become OVERLAPPING CHARACTER BIGRAMS -- the dictionary-free CJK indexing baseline (cf. Lucene CJKBigramFilter), much better recall than per-character for CJK search/matching. Non-CJK words are unchanged. (True dictionary word segmentation would be a future ICU step.)
also written: SearchTokenscomposed example
o1 = new stzString("banana split")
? @@( o1.WordsForSearch() )
#--> [ "banana", "split" ]composed from the signature, run for this page no extensionWordsThatAre
Fluent text-meaning layer -- thin delegators to the text domain (base/natural/stzText). Canonical form is Q(str).Text().<op>(); these keep Q(str).<op>() working too.QCSXTZZZIBWU
(no comment in the source: the name reads as a sentence) nouns 1 examples runin the section linguistic query . explain . explorecomposed example
o1 = new stzString("banana split")
? @@( o1.Nouns() )
#--> [ "banana", "split" ]composed from the signature, run for this page QCSXTZZZIBWU ProperNouns
(no comment in the source: the name reads as a sentence) proper nounsin the section linguistic query . explain . exploreno extension
(no comment in the source: the name reads as a sentence) verbs 1 examples runin the section linguistic query . explain . exploreQCSXTZZZIBWU (no comment in the source: the name reads as a sentence) adjectives 1 examples runin the section linguistic query . explain . exploreQCSXTZZZIBWU (no comment in the source: the name reads as a sentence) adverbs 1 examples runin the section linguistic query . explain . exploreno extension Pronouns
(no comment in the source: the name reads as a sentence) pronounsin the section linguistic query . explain . exploreno extension
SentencesThatAre
(no comment in the source: the name reads as a sentence) sentences that arein the section linguistic query . explain . exploreno extension
PositiveSentences
(no comment in the source: the name reads as a sentence) positive sentencesin the section linguistic query . explain . exploreno extension
NegativeSentences
(no comment in the source: the name reads as a sentence) negative sentencesin the section linguistic query . explain . exploreno extension
(no comment in the source: the name reads as a sentence) most positive sentence 1 examples runin the section linguistic query . explain . exploreno extension (no comment in the source: the name reads as a sentence) most negative sentence 1 examples runin the section linguistic query . explain . exploreno extension (no comment in the source: the name reads as a sentence) most similar sentence to 1 examples runin the section linguistic query . explain . exploreno extension (no comment in the source: the name reads as a sentence) language 1 examples runalso written: DetectedLanguagein the section linguistic query . explain . explorecomposed example
o1 = new stzString("banana split")
? o1.Language()
#--> unknowncomposed from the signature, run for this page no extension AutoLemmatized
(no comment in the source: the name reads as a sentence) auto lemmatizedin the section linguistic query . explain . exploreno extension
AutoStemmed
(no comment in the source: the name reads as a sentence) auto stemmedin the section linguistic query . explain . exploreno extension
SentimentExplained
(no comment in the source: the name reads as a sentence) sentiment explainedin the section linguistic query . explain . exploreno extension
ReadabilityExplained
(no comment in the source: the name reads as a sentence) readability explainedin the section linguistic query . explain . exploreno extension
Profile
(no comment in the source: the name reads as a sentence) profilein the section linguistic query . explain . exploreno extension
(no comment in the source: the name reads as a sentence) lexical diversity 1 examples runalso written: TypeTokenRatioin the section linguistic query . explain . exploreo1 = new stzString("The cat sat on the mat in the warm sun")
# lexical diversity is distinct/total words (8 distinct / 10)
? o1.LexicalDiversity()
ac = o1.ComparedTo("The dog sat on the mat in the cold rain")
# shared content vocabulary
? @@(ac[4][2])
#--> 0.80
#--> [ "sat", "mat" ]library testno extension StyleProfile
(no comment in the source: the name reads as a sentence) style profilein the section linguistic query . explain . exploreno extension
InContextWithWindow
(no comment in the source: the name reads as a sentence) in context with windowin the section linguistic query . explain . exploreno extension
InContext
(no comment in the source: the name reads as a sentence) in contextalso written: Concordancein the section linguistic query . explain . exploreno extension
ComparedTo
(no comment in the source: the name reads as a sentence) compared toin the section linguistic query . explain . explorecomposed example
o1 = new stzString("banana split")
? @@( o1.ComparedTo("an") )
#--> [ [ "similarity", 0 ], [ "sentiment_delta", 0 ], [ "grade_delta", 12.19 ], [ "shared_keywords", [ ] ] ]composed from the signature, run for this page no extension ShowTagged
(no comment in the source: the name reads as a sentence) show taggedin the section linguistic query . explain . exploreno extension
ShowEntities
(no comment in the source: the name reads as a sentence) show entitiesin the section linguistic query . explain . exploreno extension
ShowSentiment
(no comment in the source: the name reads as a sentence) show sentimentin the section linguistic query . explain . exploreno extension
Split the string into a list of parts around a separator.
6 examples runalso named: split separate tokenize break apart delimiter explode cut into parts separate tokenize break apart cut into parts explode divide on# Split on the literal hyphen
? @@( Q("ONE-TWO-THREE").Split("-") )
# SplitW at every non-letter is equivalent
? @@( Q("ONE-TWO-THREE").SplitW('{ Q(@char).IsNotLetter() }') )
#--> [ "ONE", "TWO", "THREE" ]
#--> [ "ONE", "TWO", "THREE" ]library testQCSXTZZZIBWUSplitToNParts
SplitToNParts: split the string into fixed-size character chunks of n characters each. The split is RIGHT-anchored (counting from the end of the string), which is the natural shape for digit grouping -- "1234567" with n=3 gives ["1", "234", "567"]. The Q form returns a stzList wrapper for fluent chaining.
also written: SplitInNPartscomposed example
o1 = new stzString("banana split")
? @@( o1.SplitToNParts(2) )
#--> [ "banana", " split" ]composed from the signature, run for this page QCSXTZZZIBWUA copy without leading and trailing whitespace; the original is unchanged.
2 examples runalso named: without surrounding spaces whitespace stripped without padding cleanedo1 = new stzString(" lots of whitespace ")
# edges trimmed
? o1.Trimmed()
# then squeezed and shouted
? o1.SimplifyQ().Uppercased()
#--> lots of whitespace
#--> LOTS OF WHITESPACElibrary testno extensionTrimmedLeft
A copy with the leading spaces removed; the original is unchanged.no extension
TrimmedRight
A copy with the trailing spaces removed; the original is unchanged.no extension
The lines of the string, as a list.
1 examples runalso named: split into lines rows of text line by linecomposed example
o1 = new stzString("banana split")
? @@( o1.Lines() )
#--> [ "banana split" ]composed from the signature, run for this page QCSXTZZZIBWUQRTHow many lines the string holds.
1 examples runcomposed example
o1 = new stzString("banana split")
? o1.NumberOfLines()
#--> 1composed from the signature, run for this page no extensionTRUE if the string is a valid Unicode char NAME.
1 examples runalso written: IsACharName# a digit name
? Q("DIGIT ZERO").IsCharName()
# a latin letter name
? Q("LATIN CAPITAL LETTER O").IsCharName()
# a javanese name
? Q("JAVANESE PADA PISELEH").IsCharName()
#--> 1
#--> 1
#--> 1library testno extensionDotless / DotsRemoved: return the content with dots stripped from "i" and "j" (Unicode "Latin Letter Dotless I" / "Dotless J"). Lossy on purpose -- meant for the typographic effect, not for round-trippable encoding. Port from archive line 93405. DiacriticsRemoved: strip combining diacritic codepoints from the content. Uses NFD normalisation to decompose accented letters into base + combining marks, then drops any codepoint in the combining ranges: U+0300-U+036F Combining Diacritical Marks (Latin etc.) U+0610-U+061A Arabic U+064B-U+065F Arabic Tashkil (Fatha, Damma, ...) U+06D6-U+06ED Arabic supplementals U+0951-U+0954 Vedic / Devanagari
1 examples runalso written: WithoutDiacritics# a French sentence loses its accents
? StzStringQ("C'était un énoncé accentuée, à vrai-dire, extrâ!").DiacriticsRemoved()
# an Arabic greeting loses its harakat
? StzStringQ("السَّلَامُ عَلَيْكُمْ").DiacriticsRemoved()
#--> C'etait un enonce accentuee, a vrai-dire, extra!
#--> السلام عليكمlibrary testno extensionRemoveDiacritics
Remove the diacritics (accents) in place (mutating). For a copy, use DiacriticsRemoved.QCSXTZZZIBWU
TRUE if the string contains diacritics (accents).
1 examples runalso written: HasDiacriticscomposed example
o1 = new stzString("banana split")
? o1.ContainsDiacritics()
#--> 0composed from the signature, run for this page no extensionDotsRemoved
The string in its dotless skeleton (rasm) -- the diacritic dots removed (Arabic-aware); the original is unchanged.
also written: Dotless · WithoutDots · DotsOnLettersRemoved · WithoutDotsOnLetterscomposed example
o1 = new stzString("banana split")
? o1.DotsRemoved()
#--> banana splıtcomposed from the signature, run for this page no extensionNLeftChars
The n leftmost chars, as a string (direction-aware).
also written: NLeftCharsAsStringcomposed example
o1 = new stzString("banana split")
? o1.NLeftChars(2)
#--> bacomposed from the signature, run for this page QCSXTZZZIBWUNRightChars
The n rightmost chars, as a string (direction-aware).
also written: NRightCharsAsStringcomposed example
o1 = new stzString("banana split")
? o1.NRightChars(2)
#--> itcomposed from the signature, run for this page QCSXTZZZIBWUNFirstChars
The first n chars of the string.
composed example
o1 = new stzString("banana split")
? o1.NFirstChars(2)
#--> bacomposed from the signature, run for this page QCSXTZZZIBWUThe last n chars of the string.
1 examples runcomposed example
o1 = new stzString("banana split")
? o1.NLastChars(2)
#--> itcomposed from the signature, run for this page QCSXTZZZIBWURemove the chars at positions n1..n2 (mutating).
1 examples runo1 = new stzString("ABC456DE")
o1.RemoveSection(4, 6)
# the digits vanish
? o1.Content()
#--> ABCDElibrary testQCSXTZZZIBWURemove the chars of each given [start, end] section (mutating).
2 examples runo1 = new stzString("1♥♥456♥♥901♥♥4")
o1.RemoveSections([ 2:3, 7:8, 12:13 ])
# the three heart pairs are gone
? o1.Content()
#--> 14569014library testno extensionReplaceSections
Replace each given [start, end] section with pcNewSubStr (mutating).no extension
ReplaceSectionsByMany(aSections, paReplacements): replace each [n1, n2] section in aSections with the corresponding replacement from paReplacements. Walks sections in reverse so earlier positions stay valid as later ones shift.
7 examples runo1 = new stzString("123---78--")
o1.ReplaceSectionsByMany([ [1, 3], [7, 8] ], [ "*", "~" ])
# shrunk
? o1.Content()
#--> *---~--library testQCSXTZZZIBWURemove the leading spaces in place (mutating). For a copy, use TrimmedLeft.
2 examples runalso named: strip leading spaces remove left whitespaceno extensionRemove the trailing spaces in place (mutating). For a copy, use TrimmedRight.
2 examples runno extensionTrimStart
Same as TrimLeft: Remove the leading spaces in place (mutating). For a copy, use TrimmedLeft.no extension
TrimEnd
Same as TrimRight: Remove the trailing spaces in place (mutating). For a copy, use TrimmedRight.no extension
RemoveThisCharFromStart
Same as RemoveThisCharFromStartXT: RemoveThisCharFromStart / Left / End / Right -- strip every leading (or trailing) occurrence of pcChar. No-op if the string doesn't start (or end) with pcChar.QCSXTZZZIBWU
RemoveThisCharFromLeft
Same as RemoveThisCharFromStartXT: RemoveThisCharFromStart / Left / End / Right -- strip every leading (or trailing) occurrence of pcChar. No-op if the string doesn't start (or end) with pcChar.QCSXTZZZIBWU
RemoveThisCharFromEnd
Same as RemoveThisCharFromEndXT: Drop the trailing run of pcChar from the end of the string (mutating).QCSXTZZZIBWU
Same as RemoveThisCharFromEndXT: Drop the trailing run of pcChar from the end of the string (mutating).
1 examples runo1 = new stzString("12.58000")
o1.RemoveThisCharFromRightXT("0")
# the trailing zeros are gone
? o1.Content()
#--> 12.58library testQCSXTZZZIBWUReplaceLeadingChars(:With = pcNew) -- collapse the leading run of a single repeated char into one instance of pcNew. Examples: "___VAR---" + :With="*" -> "*VAR---" "aaaaHELLO" + :With="A" -> "AHELLO" If there's no run (the first 2 chars differ), the string is returned unchanged.
3 examples runQCSXTZZZIBWUReplace the run of identical chars at the end of the string with the given string (mutating).
3 examples runQCSXTZZZIBWUSame as ReplaceLeadingChars: ReplaceLeadingChars(:With = pcNew) -- collapse the leading run of a single repeated char into one instance of pcNew. Examples: "___VAR---" + :With="*" -> "*VAR---" "aaaaHELLO" + :With="A" -> "AHELLO" If there's no run (the first 2 chars differ), the string is returned unchanged.
1 examples runQCSXTZZZIBWUReplaceLeadingChar(pcChar, :With = pcNew) -- replace the leading run only IF the leading char equals pcChar. Otherwise no-op.
3 examples runQCSXTZZZIBWUReplace the trailing run of pcChar with the given string (mutating).
2 examples runno extensionRemove leading and trailing whitespace in place (mutating). For a copy, use Trimmed.
1 examples runo1 = new stzString(" ♥♥♥123♥♥♥ ")
o1.Trim()
# only the spaces went
? o1.Content()
#--> ♥♥♥123♥♥♥library testQCSXTZZZIBWUContainsDuplicates
Same as ContainsDuplicatesCS: Same as ContainsDuplicatedSubStringsCS: TRUE if some substring occurs more than once in the string.
composed example
o1 = new stzString("banana split")
? o1.ContainsDuplicates()
#--> 1composed from the signature, run for this page QCSXTZZZIBWUContainsDuplicatedSubStrings
Same as ContainsDuplicatedSubStringsCS: TRUE if some substring occurs more than once in the string.
composed example
o1 = new stzString("banana split")
? o1.ContainsDuplicatedSubStrings()
#--> 1composed from the signature, run for this page QCSXTZZZIBWUDuplicatedSubStrings
Same as DuplicatedSubStringsCS: The substrings that occur more than once in the string.
composed example
o1 = new stzString("banana split")
? @@( o1.DuplicatedSubStrings() )
#--> [ "a", "n" ]composed from the signature, run for this page QCSXTZZZIBWUNumberOfDuplicates
Same as NumberOfDuplicatesCS: How many duplicated occurrences the string holds.
composed example
o1 = new stzString("banana split")
? o1.NumberOfDuplicates()
#--> 4composed from the signature, run for this page QCSXTZZZIBWUHasDuplicatedChars
TRUE if some char occurs more than once.
composed example
o1 = new stzString("banana split")
? o1.HasDuplicatedChars()
#--> 1composed from the signature, run for this page no extensionUpTo
For a single-char string: the chars from it UP TO the given char, as a list.no extension
DownTo
For a single-char string: the chars from it DOWN TO the given char, as a list.no extension
Box
Surround the content with the Softanza box in place (mutating). For a copy, use Boxed.QCSXTZZZIBWU
BoxRound
Box the content with rounded corners in place (mutating).no extension
BoxifyRound
Same as BoxRound: Box the content with rounded corners in place (mutating).QCSXTZZZIBWU
A boxed copy of the string; the original is unchanged.
4 examples runcomposed example
o1 = new stzString("banana split")
? o1.Boxed()
#--> ┌──────────────┐
#--> │ banana split │
#--> └──────────────┘composed from the signature, run for this page QCSXTZZZIBWUBoxedRound
A rounded-corner boxed copy of the string.
also written: BoxedDashed · BoxedRoundedcomposed example
o1 = new stzString("banana split")
? o1.BoxedRound()
#--> ╭──────────────╮
#--> │ banana split │
#--> ╰──────────────╯composed from the signature, run for this page no extensionBoxedRoundedDashed
A rounded, dashed-line boxed copy of the string.
also written: BoxedRoundDashedcomposed example
o1 = new stzString("banana split")
? o1.BoxedRoundedDashed()
#--> ╭╌╌╌╌╌╌╌╌╌╌╌╌╌╌╮
#--> ┊ banana split ┊
#--> ╰╌╌╌╌╌╌╌╌╌╌╌╌╌╌╯composed from the signature, run for this page no extensionEachCharBoxed
Each char in its own box cell, as a string.
also written: EachCharBoxed_aliascomposed example
o1 = new stzString("banana split")
? o1.EachCharBoxed()
#--> ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┐
#--> │ b │ a │ n │ a │ n │ a │ │ s │ p │ l │ i │ t │
#--> └───┴───┴───┴───┴───┴───┴───┴───┴───┴───┴───┴───┘composed from the signature, run for this page QCSXTZZZIBWUBoxRoundEachChar
BoxRoundEachChar: surround each char with a rounded-corner box.QCSXTZZZIBWU
SplitAroundPosition
SplitAroundPosition(n): two pieces around codepoint position n.
composed example
o1 = new stzString("banana split")
? @@( o1.SplitAroundPosition(2) )
#--> [ "b", "nana split" ]composed from the signature, run for this page no extensionTheseCharsZ
TheseCharsZ([chars]): each char grouped with ALL its positions -- [ [c, [positions]], ... ].
composed example
o1 = new stzString("banana split")
? @@( o1.TheseCharsZ([ "an", "a" ]) )
#--> [ [ "an", [ 2, 4 ] ], [ "a", [ 2, 4, 6 ] ] ]composed from the signature, run for this page no extensionAlignXT
Align the content in a field of nWidth chars, padded with cFillChar, to the given direction (mutating).QCSXTZZZIBWU
UniqueChars
Same as CharsU: The UNIQUE chars of the string, in first-seen order.
composed example
o1 = new stzString("banana split")
? @@( o1.UniqueChars() )
#--> [ "b", "a", "n", " ", "s", "p", "l", "i", "t" ]composed from the signature, run for this page no extensionThe codepoint of a single-char string -- or the codepoints list for a longer one.
1 examples run# 'I' is codepoint 73
? Q("I").Unicode()
#--> 73library testno extensionCharName / CharacterName / UnicodeName -- when the string IS a single character, return its Unicode name (CHECK MARK etc.). Convenient on Q("✓") narratives that avoid the StzCharQ() ramp. Haro chained-new+method parses oddly here, so split into two.
2 examples runalso written: UnicodeName · CharacterNameno extensionUnicodes
The codepoint of each char, as a list.
composed example
o1 = new stzString("banana split")
? @@( o1.Unicodes() )
#--> [ 98, 97, 110, 97, 110, 97, 32, 115, 112, 108, 105, 116 ]composed from the signature, run for this page QCSXTZZZIBWUCharsAndUnicodes
Each char paired with its codepoint: [ [char, unicode], ... ].
also written: UnicodePerCharcomposed example
o1 = new stzString("banana split")
? @@( o1.CharsAndUnicodes() )
#--> [ [ "b", 98 ], [ "a", 97 ], [ "n", 110 ], [ "a", 97 ], [ "n", 110 ], [ "a", 97 ], [ " ", 32 ], [ "s", 115 ], [ "p", 112 ], [ "l", 108 ], [ "i", 105 ], [ "t", 116 ] ]composed from the signature, run for this page QCSXTZZZIBWUUniqueCharsAndUnicodes
Same as CharsAndUnicodesU: The unique chars paired with their codepoints.
composed example
o1 = new stzString("banana split")
? @@( o1.UniqueCharsAndUnicodes() )
#--> [ [ "b", 98 ], [ "a", 97 ], [ "n", 110 ], [ " ", 32 ], [ "s", 115 ], [ "p", 112 ], [ "l", 108 ], [ "i", 105 ], [ "t", 116 ] ]composed from the signature, run for this page no extensionThe string repeated n times.
1 examples runalso named: repeat duplicate times concatenate copies tile duplicate repeat n times multiply the string echoalso written: RepeatedNTimescomposed example
o1 = new stzString("banana split")
? o1.Repeated(2)
#--> banana splitbanana splitcomposed from the signature, run for this page no extensionRepeat
Turn the content into itself repeated n times (mutating). For a copy, use Repeated.
composed example
o1 = new stzString("banana split")
o1.Repeat(2)
? o1.Content()
#--> banana splitbanana splitcomposed from the signature, run for this page QCSXTZZZIBWUConcatenate
Append the given string at the end (mutating). For a copy, use Concatenated.QCSXTZZZIBWU
Append
Same as Concatenate: Append the given string at the end (mutating). For a copy, use Concatenated.
also named: add to the end concatenate tack on put after join tocomposed example
o1 = new stzString("banana split")
o1.Append("an")
? o1.Content()
#--> banana splitancomposed from the signature, run for this page QCSXTZZZIBWUConcatenated
The string with pcStr appended, as data; the original is unchanged.
composed example
o1 = new stzString("banana split")
? o1.Concatenated("an")
#--> banana splitancomposed from the signature, run for this page no extensionTRUE if the content equals the given string (case-sensitive).
6 examples runcomposed example
o1 = new stzString("banana split")
? o1.IsEqualTo("an")
#--> 0composed from the signature, run for this page QCSXTZZZIBWUIsStrictlyEqualTo
Strict equality: same content AND same Haro type (string). When the other side is a list/number, returns 0. Used by stzHashList.KeysForValue to compare values polymorphically.
composed example
o1 = new stzString("banana split")
? o1.IsStrictlyEqualTo(3)
#--> 0composed from the signature, run for this page no extensionRemoveFirstCharCS(pCaseSensitive): "permissiveness" form -- accepts the case-sensitivity flag for narrative-symmetry, but ignores it (per stzStringTest block #37). (case-sensitive by default)
2 examples runo1 = new stzString("1BATISTA")
o1.RemoveFirstChar()
# mutated in place
? o1.Content()
# or functionally
? StzStringQ("1BATISTA").FirstCharRemoved()
#--> BATISTA
#--> BATISTAlibrary testQCSXTZZZIBWURemoveLeadingChars
RemoveLeadingChars / RemoveTrailingChars / RemoveBoundingChars: strip every leading (or trailing, or both) char that matches the first (resp. last) char of the current content. Equivalent to the "trim run" interpretation in narrative tests.
composed example
o1 = new stzString("banana split")
o1.RemoveLeadingChars()
? o1.Content()
#--> anana splitcomposed from the signature, run for this page QCSXTZZZIBWULeadingCharsAsString
LeadingChars() / TrailingChars() -- return the leading (or trailing) RUN of identical chars as a single string. e.g. "----Haro" -> "----". Used by narrative leading-char analysis. LeadingChars() returns the leading run as a LIST of chars (e.g. ["-","-","-"]); LeadingCharsAsString() returns the run "---".also written: LeadingSubString · LeadingCharsAsSubStringQCSXTZZZIBWU
The run of identical chars at the START of the string, as a list of chars.
1 examples runQCSXTZZZIBWUThe leading char (case-dial form). (case-sensitive by default)
1 examples runo1 = new stzString("000122.12")
# the leading char
? o1.LeadingChar()
o1.RemoveThisLeadingChar("0")
# the run is gone
? o1.Content()
#--> 0
#--> 122.12library testQCSXTZZZIBWUNumberOfLeadingChars
Same as NumberOfLeadingItems: How long the leading char run is. (case-sensitive by default)
composed example
o1 = new stzString("banana split")
? o1.NumberOfLeadingChars()
#--> 0composed from the signature, run for this page QCSXTZZZIBWUTrailingCharsAsString
The run of identical chars at the end of the string, as a string.also written: TrailingSubStringQCSXTZZZIBWU
TrailingChars
The run of identical chars at the END of the string, as a list of chars.QCSXTZZZIBWU
The trailing char (case-dial form). (case-sensitive by default)
2 examples runQCSXTZZZIBWUNumberOfTrailingChars
Same as NumberOfTrailingItems: How long the trailing char run is. (case-sensitive by default)
composed example
o1 = new stzString("banana split")
? o1.NumberOfTrailingChars()
#--> 0composed from the signature, run for this page QCSXTZZZIBWURemoveLeadingChar
Singular forms: RemoveLeadingChar = remove ONE leading char, RemoveAnyLeadingChar = peel every leading char of the same type.
composed example
o1 = new stzString("banana split")
o1.RemoveLeadingChar()
? o1.Content()
#--> anana splitcomposed from the signature, run for this page QCSXTZZZIBWURemoveAnyLeadingChar
Same as RemoveLeadingChars: RemoveLeadingChars / RemoveTrailingChars / RemoveBoundingChars: strip every leading (or trailing, or both) char that matches the first (resp. last) char of the current content. Equivalent to the "trim run" interpretation in narrative tests.
composed example
o1 = new stzString("banana split")
o1.RemoveAnyLeadingChar()
? o1.Content()
#--> anana splitcomposed from the signature, run for this page no extensionRemoveTrailingChar
Drop the LAST char of the string (one char, from the end) -- mutating.
composed example
o1 = new stzString("banana split")
o1.RemoveTrailingChar()
? o1.Content()
#--> banana splicomposed from the signature, run for this page QCSXTZZZIBWURemoveTrailingChars
Drop the whole trailing run of the string's last char (mutating).
composed example
o1 = new stzString("banana split")
o1.RemoveTrailingChars()
? o1.Content()
#--> banana splicomposed from the signature, run for this page QCSXTZZZIBWURemoveBoundingChars
Same as RemoveLeadingChars: RemoveLeadingChars / RemoveTrailingChars / RemoveBoundingChars: strip every leading (or trailing, or both) char that matches the first (resp. last) char of the current content. Equivalent to the "trim run" interpretation in narrative tests.
composed example
o1 = new stzString("banana split")
o1.RemoveBoundingChars()
? o1.Content()
#--> anana splicomposed from the signature, run for this page QCSXTZZZIBWUImmutable / past-tense forms: return the modified content without mutating This. Used by stzNumber.Absolute() and similar fluent chains.
1 examples runo1 = new stzString("1BATISTA")
o1.RemoveFirstChar()
# mutated in place
? o1.Content()
# or functionally
? StzStringQ("1BATISTA").FirstCharRemoved()
#--> BATISTA
#--> BATISTAlibrary testno extensionA copy with the last char removed; the original is unchanged.
1 examples runo1 = new stzString("BATISTA1")
o1.RemoveLastChar()
# mutated in place
? o1.Content()
# or functionally
? StzStringQ("BATISTA1").LastCharRemoved()
#--> BATISTA
#--> BATISTAlibrary testno extensionRemove the last char of the string (mutating).
1 examples runo1 = new stzString("BATISTA1")
o1.RemoveLastChar()
# mutated in place
? o1.Content()
# or functionally
? StzStringQ("BATISTA1").LastCharRemoved()
#--> BATISTA
#--> BATISTAlibrary testQCSXTZZZIBWUSame as RemoveFirstChar: RemoveFirstCharCS(pCaseSensitive): "permissiveness" form -- accepts the case-sensitivity flag for narrative-symmetry, but ignores it (per stzStringTest block #37). (case-sensitive by default)
1 examples run# removing the first and last chars leaves the inner content
o = new stzString('[ @$2{"a";1;[1]}U ]')
o.RemoveFirstAndLastChars()
? o.Content()
#--> @$2{"a";1;[1]}Ulibrary testQCSXTZZZIBWUConditional first/last char removers: act only if the first (resp. last) char equals pcChar. Used by code-string fluent chains that may or may not see leading/trailing braces.
2 examples runo1 = new stzString("{abc}")
o1.RemoveThisFirstChar("{")
o1.RemoveThisLastChar("}")
# both braces gone
? o1.Content()
#--> abclibrary testQCSXTZZZIBWURemove the last char when it equals pcChar (mutating).
1 examples runo1 = new stzString("{abc}")
o1.RemoveThisFirstChar("{")
o1.RemoveThisLastChar("}")
# both braces gone
? o1.Content()
#--> abclibrary testQCSXTZZZIBWUThe raw bytes of the string, as a list.
1 examples runo1 = new stzString("s㊱m")
? o1.NumberOfBytes()
? o1.SizeInBytes()
? @@(o1.Bytes())
? @@(o1.NumberOfBytesPerChar())
#--> 5
#--> 5
#--> [ "s", "�", "�", "�", "m" ]
#--> [ [ "s", 1 ], [ "㊱", 3 ], [ "m", 1 ] ]library testno extensionBytesPerChar
The bytes of each char, char by char.
composed example
o1 = new stzString("banana split")
? @@( o1.BytesPerChar() )
#--> [ [ "b", [ "b" ] ], [ "a", [ "a" ] ], [ "n", [ "n" ] ], [ "a", [ "a" ] ], [ "n", [ "n" ] ], [ "a", [ "a" ] ], [ " ", [ " " ] ], [ "s", [ "s" ] ], [ "p", [ "p" ] ], [ "l", [ "l" ] ], [ "i", [ "i" ] ], [ "t", [ "t" ] ] ]composed from the signature, run for this page no extensionHow many bytes each char occupies (UTF-8), as a list.
1 examples runo1 = new stzString("s㊱m")
? o1.NumberOfBytes()
? o1.SizeInBytes()
? @@(o1.Bytes())
? @@(o1.NumberOfBytesPerChar())
#--> 5
#--> 5
#--> [ "s", "�", "�", "�", "m" ]
#--> [ [ "s", 1 ], [ "㊱", 3 ], [ "m", 1 ] ]library testno extensionThe size of the string in bytes (UTF-8).
1 examples runo1 = new stzString("s㊱m")
? o1.NumberOfBytes()
? o1.SizeInBytes()
? @@(o1.Bytes())
? @@(o1.NumberOfBytesPerChar())
#--> 5
#--> 5
#--> [ "s", "�", "�", "�", "m" ]
#--> [ [ "s", 1 ], [ "㊱", 3 ], [ "m", 1 ] ]library testno extensionBytecodes
The numeric byte codes of the string, as a list.
composed example
o1 = new stzString("banana split")
? @@( o1.Bytecodes() )
#--> [ 98, 97, 110, 97, 110, 97, 32, 115, 112, 108, 105, 116 ]composed from the signature, run for this page no extensionBytecodesPerChar
The byte codes of each char, char by char.
composed example
o1 = new stzString("banana split")
? @@( o1.BytecodesPerChar() )
#--> [ [ "b", [ 98 ] ], [ "a", [ 97 ] ], [ "n", [ 110 ] ], [ "a", [ 97 ] ], [ "n", [ 110 ] ], [ "a", [ 97 ] ], [ " ", [ 32 ] ], [ "s", [ 115 ] ], [ "p", [ 112 ] ], [ "l", [ 108 ] ], [ "i", [ 105 ] ], [ "t", [ 116 ] ] ]composed from the signature, run for this page no extensionSizeInBytesPerChar
How many bytes each char occupies (UTF-8), as a list.
composed example
o1 = new stzString("banana split")
? @@( o1.SizeInBytesPerChar() )
#--> [ [ "b", 1 ], [ "a", 1 ], [ "n", 1 ], [ "a", 1 ], [ "n", 1 ], [ "a", 1 ], [ " ", 1 ], [ "s", 1 ], [ "p", 1 ], [ "l", 1 ], [ "i", 1 ], [ "t", 1 ] ]composed from the signature, run for this page no extensionThe size of the string in bytes (UTF-8).
3 examples runo1 = new stzString("s㊱m")
? o1.NumberOfBytes()
? o1.SizeInBytes()
? @@(o1.Bytes())
? @@(o1.NumberOfBytesPerChar())
#--> 5
#--> 5
#--> [ "s", "�", "�", "�", "m" ]
#--> [ [ "s", 1 ], [ "㊱", 3 ], [ "m", 1 ] ]library testno extensionSame as ContainsOneOfTheseCS: TRUE if the string contains at least ONE of the given substrings.
2 examples runcomposed example
o1 = new stzString("banana split")
? o1.ContainsOneOfThese([ "an", "a" ])
#--> 1composed from the signature, run for this page QCSXTZZZIBWUContainsEither(arg1, arg2): two-arg form covers the narrative shapes. arg2 can be the :Or = "..." named-param, or any string (treated as the second alternative); if arg1 is itself a list of substrings and arg2 is "", we fall back to ContainsOneOfThese.
1 examples run# both words present is still TRUE (inclusive)
? Q("me you all the others").ContainsEither("me", :Or = "you")
# only one word present is TRUE
? Q("me and all the others").ContainsEither("me", :Or = "you")
#--> 1
#--> 1library testno extensionSame as FindTheseBoundsCS: Find the given opening and closing bounds: their positions in the string.
1 examples run# FindTheseBounds reports the outer [ ] positions
? @@( Q('[ @$2{"a";1;[1]}U ]').FindTheseBounds("[", "]") )
# RemoveTheseBounds drops the outer bounds
o = new stzString('[ @$2{"a";1;[1]}U ]')
o.RemoveTheseBounds("[", "]")
? o.Content()
#--> [ 1, 15 ]
#--> @$2{"a";1;[1}U ]library testQCSXTZZZIBWURemove the given opening and closing bounds when they enclose the string (mutating).
2 examples runo1 = new stzString("<<word>>")
# it is angle-bounded
? o1.IsBoundedBy(["<<", ">>"])
o1.RemoveTheseBounds("<<",">>")
# stripped
? o1.Content()
#--> 1
#--> wordlibrary testQCSXTZZZIBWUSingle-bound forms: same character on both sides. E.g. RemoveBounds('"') strips matching leading + trailing quotes. RemoveBounds(): no-arg, AUTO-detects the bounds and removes them in place (the mutating active form of BoundsRemoved). Matches the original.
1 examples runcomposed example
o1 = new stzString("banana split")
o1.RemoveBounds()
? o1.Content()
#--> anana splicomposed from the signature, run for this page QCSXTZZZIBWURemoveThisBound
RemoveThisBound(c): remove a specific same-char bound from both ends.
composed example
o1 = new stzString("banana split")
o1.RemoveThisBound("an")
? o1.Content()
#--> ba splitcomposed from the signature, run for this page QCSXTZZZIBWUSame as BetweenCS: Between() returns ALL substrings between bounds (Softanza Universal Naming Convention) FirstBetween/LastBetween/NthBetween for specific occurrences Between: the GREEDY single span between the FIRST open and the LAST close (matches the original Softanza Between -- returns a STRING, not a list).
1 examples runcomposed example
o1 = new stzString("banana split")
? o1.Between(TRUE, TRUE)
#--> bacomposed from the signature, run for this page QCSXTZZZIBWUSame as BoundedByCS: BoundedBy: same semantics as Between() (returns the list of substrings sitting between matched open/close delimiters) but takes the bounds packed as a 2-list [ open, close ]. Matches the archive API at line 34272 + 34290. Used by ccode tests that read like `o1.BoundedBy([ "[", "]" ])`.
3 examples runalso written: SubStringsBoundedBy · AnySubStringsBoundedByo1 = new stzString("blabla bla <<word1>> bla bla <<word2>>")
? o1.SubstringsBoundedBy([ "<<", ">>" ])
#--> word1
#--> word2library testQCSXTZZZIBWUAnyBoundedBy
AnyBoundedBy: the bounded SUBSTRINGS, derived from FindAnyBoundedByZZ so a repeated single bound ("*") keeps every overlapping region (BoundedBy's non-overlapping pairing drops the middles). AnyBoundedByZZ pairs each substring with its [start, end] span.QCSXTZZZIBWU
ContainsSubStringsBoundedBy
TRUE if some substring is bounded by the given bounds. (case-sensitive by default)
also written: ContainsBoundedBy · ContainsAnyBoundedBycomposed example
o1 = new stzString("banana split")
? o1.ContainsSubStringsBoundedBy([ "an", "a" ])
#--> 1composed from the signature, run for this page QCSXTZZZIBWUFirstBetween
Same as FirstBetweenCS: first between (single result)QCSXTZZZIBWU
LastBetween
Same as LastBetweenCS: last between (single result)QCSXTZZZIBWU
NthBetween
Same as NthBetweenCS: nth between (single result)QCSXTZZZIBWU
ReplaceBetween
Engine replaces INCLUDING bounds. For default (bounds preserved), we wrap replacement with pcOpen + replacement + pcClose. IB variants pass replacement directly (engine includes bounds).
composed example
o1 = new stzString("banana split")
o1.ReplaceBetween("an", "an", "AN")
? o1.Content()
#--> banANana splitcomposed from the signature, run for this page QCSXTZZZIBWUReplaceFirstBetween
Replace what lies between the FIRST pcOpen...pcClose pair (the bounds stay) -- engine-backed, mutating.
composed example
o1 = new stzString("banana split")
o1.ReplaceFirstBetween("an", "an", "AN")
? o1.Content()
#--> banANana splitcomposed from the signature, run for this page QCSXTZZZIBWUReplaceLastBetween
Replace what lies between the LAST pcOpen...pcClose pair (the bounds stay) -- mutating.
composed example
o1 = new stzString("banana split")
o1.ReplaceLastBetween("an", "an", "AN")
? o1.Content()
#--> banANana splitcomposed from the signature, run for this page QCSXTZZZIBWUReplaceNthBetween
Replace what lies between the NTH pcOpen...pcClose pair (the bounds stay) -- mutating.QCSXTZZZIBWU
Remove what lies between every pcOpen...pcClose pair (the bounds stay) -- mutating.
2 examples runo1 = new stzString("__/♥\__")
o1.RemoveBetween("/", "\")
# the heart between / and \\ is gone, bounds kept
? o1.Content()
#--> __/\__library testQCSXTZZZIBWURemoveFirstBetween
Remove what lies between the FIRST pair only (the bounds stay) -- mutating.QCSXTZZZIBWU
RemoveLastBetween
Remove what lies between the LAST pair only (the bounds stay) -- mutating.QCSXTZZZIBWU
RemoveNthBetween
Remove what lies between the NTH pair only (the bounds stay) -- mutating.QCSXTZZZIBWU
ContainsThese
contains these
also written: ContainsAllOfThesecomposed example
o1 = new stzString("banana split")
? o1.ContainsThese([ "an", "a" ])
#--> 1composed from the signature, run for this page QCSXTZZZIBWUSame as FindAsSectionsCS: The [start, end] section of every occurrence of pcSubStr.
2 examples runalso written: FindAllAsSectionso1 = new stzString(' str = " ... " and str != " *** " ')
? @@NL( o1.BoundedBy('"') ) + NL
? @@( o1.FindAsSections( o1.BoundedBy('"') ) )
#--> [ " ... ", " and str != ", " *** " ]
#--> [ [ 11, 17 ], [ 19, 39 ], [ 41, 46 ] ]library testQCSXTZZZIBWUDFindAsSection
Same as FindAsSectionCS: Singular form: returns the first occurrence as a [start, end] section (rather than a list of sections). Useful when the narrative cares about "where IS that one substring".
also written: FindFirstAsSectioncomposed example
o1 = new stzString("banana split")
? @@( o1.FindAsSection("an") )
#--> [ 2, 3 ]composed from the signature, run for this page QCSXTZZZIBWUSTSame as FindManyAsSectionsCS: Plural with explicit "Many" prefix: same semantics as FindAsSections but accepts a list of substrings, with the results from all of them flattened into a single ordered list.
1 examples runo1 = 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
#--> [ 4, 10, 14, 20 ]
#--> [ [ 4, 6 ], [ 10, 11 ], [ 14, 16 ], [ 20, 21 ] ]
#--> [ 4, 10, 14, 20 ]
#--> [ [ 4, 6 ], [ 10, 11 ], [ 14, 16 ], [ 20, 21 ] ]library testQCSXTZZZIBWUMultiReplaced
Same as MultiReplacedCS: ONE-PASS dictionary replace: old[i] -> new[i], scanning the text ONCE. The FIRST matching pattern (in list order) wins at each position and the scan advances past it -- so a replacement's output is NEVER re-matched (no cascade). Contrast the classic ReplaceManyByMany which runs N sequential Replace passes (N full rebuilds + cascade). For templating, sanitization and dictionary substitution. Patterns must not contain NUL.QCSXTZZZIBWU
MultiReplace
Replace each substring of paOlds with its counterpart in paNews (pairwise, mutating).QCSXTZZZIBWU
ManyReplaced
Same as ManyReplacedCS: Immutable forms of ReplaceMany. Return the new string content without mutating This. Ported from archive line 41923.
also written: TheseReplaced · SubStringsReplaced · ManySubstringsReplaced · TheseSubstringsReplacedcomposed example
o1 = new stzString("banana split")
? o1.ManyReplaced([ "an", "a" ], "AN")
#--> bANANAN splitcomposed from the signature, run for this page QCSXTZZZIBWURemoveNth
Same as RemoveNthCS: Remove only the nth occurrence of pcSubStr (mutating).
composed example
o1 = new stzString("banana split")
o1.RemoveNth(2, "an")
? o1.Content()
#--> bana splitcomposed from the signature, run for this page QCSXTZZZIBWUSurround
Put pcBefore and pcAfter around the content (mutating). For a copy, use Surrounded.also named: wrap enclose put around bracket withQCSXTZZZIBWU
Surrounded
The content with pcBefore and pcAfter around it, as data.
composed example
o1 = new stzString("banana split")
? o1.Surrounded("an", "an")
#--> anbanana splitancomposed from the signature, run for this page no extensionDuplicates(): every duplicated SUBSTRING (not just chars), deduped, in (i,j) scan order -- matches the original DuplicatesCS. e.g. "RINGORIALAND" -> [ "R","I","A","N", ...multi-char dups... ]. (For a string with no repeated multi-char run, this coincides with the duplicated chars.)
3 examples runcomposed example
o1 = new stzString("banana split")
? @@( o1.Duplicates() )
#--> [ "a", "an", "n", "na" ]composed from the signature, run for this page QCSXTZZZIBWUIsPalindrome
Same as IsPalindromeCS: TRUE if the string reads the same backward (a palindrome).
composed example
o1 = new stzString("banana split")
? o1.IsPalindrome()
#--> 0composed from the signature, run for this page QCSXTZZZIBWUIsPalindromeWords
TRUE if the WORD sequence reads the same backward.
composed example
o1 = new stzString("banana split")
? o1.IsPalindromeWords()
#--> 0composed from the signature, run for this page no extensionSame as IsAnagramOfCS: TRUE if the string is an anagram of the given one (same chars, reordered).
1 examples runcomposed example
o1 = new stzString("banana split")
? o1.IsAnagramOf("an")
#--> 0composed from the signature, run for this page QCSXTZZZIBWUTRUE if the string is in UPPER CASE.
1 examples runalso named: all caps in capitals all uppercase is it shouting# happy-holidays is lowercase
? StzStringQ("happy-holidays").IsLowercase()
# HOLIDAYS! is uppercase
? StzStringQ("HOLIDAYS!").IsUppercase()
#--> 1
#--> 1library testno extensionTRUE if the string is in lower case.
4 examples runalso named: all lowercase all small letters in lower case? Q("bread").IsLowercase()
#--> 1library testno extensionIsCapitalcase
IsCapitalcase(): TRUE iff the string already equals its TITLE-cased form (every word capitalised), per the original.
composed example
o1 = new stzString("banana split")
? o1.IsCapitalcase()
#--> 0composed from the signature, run for this page no extensionIsHybridcase
TRUE if the string mixes upper and lower case.
composed example
o1 = new stzString("banana split")
? o1.IsHybridcase()
#--> 0composed from the signature, run for this page no extensionIsTitlecase
TRUE if the string is written in Title Case.
composed example
o1 = new stzString("banana split")
? o1.IsTitlecase()
#--> 0composed from the signature, run for this page no extensionIsCamelCase
TRUE if the string is written in camelCase.
composed example
o1 = new stzString("banana split")
? o1.IsCamelCase()
#--> 0composed from the signature, run for this page no extensionIsSnakeCase
TRUE if the string is written in snake_case.
composed example
o1 = new stzString("banana split")
? o1.IsSnakeCase()
#--> 0composed from the signature, run for this page no extensionIsKebabCase
TRUE if the string is written in kebab-case.
composed example
o1 = new stzString("banana split")
? o1.IsKebabCase()
#--> 0composed from the signature, run for this page no extensionContainsOnlySpaces
TRUE if the string is made of spaces only.
composed example
o1 = new stzString("banana split")
? o1.ContainsOnlySpaces()
#--> 0composed from the signature, run for this page no extensionContainsOnlyLetters
TRUE if the string is made of letters only.
composed example
o1 = new stzString("banana split")
? o1.ContainsOnlyLetters()
#--> 0composed from the signature, run for this page no extensionContainsOnlyNumbers
TRUE if the string is made of number chars only.
composed example
o1 = new stzString("banana split")
? o1.ContainsOnlyNumbers()
#--> 0composed from the signature, run for this page no extensionContainsOnlyDigits
TRUE if the string is made of digits only.
composed example
o1 = new stzString("banana split")
? o1.ContainsOnlyDigits()
#--> 0composed from the signature, run for this page no extensionContainsOnlyLettersAndNumbers
TRUE if the string is made of letters and numbers only.
composed example
o1 = new stzString("banana split")
? o1.ContainsOnlyLettersAndNumbers()
#--> 0composed from the signature, run for this page no extensionSame as IsMadeOfCS: TRUE if the string is built ONLY from the given substring(s).
6 examples run# made of m, a, a, n
? Q("maan").IsMadeOf([ "m", "a", "a", "n" ])
#--> 1library testQCSXTZZZIBWUIsMadeOfChar
Same as IsMadeOfCharCS: TRUE if the string is made of the given char only.
composed example
o1 = new stzString("banana split")
? o1.IsMadeOfChar("a")
#--> 0composed from the signature, run for this page QCSXTZZZIBWUSame as IsMadeOfSomeCS: TRUE if the string is made only of (some of) the given substrings.
4 examples run# all chars are hex digits
? Q("4E992").IsMadeOfSome( HexChars() )
#--> 1library testQCSXTZZZIBWUIsCountryName
TRUE if the string names a country (per the locale data).
composed example
o1 = new stzString("banana split")
? o1.IsCountryName()
#--> 0composed from the signature, run for this page no extensionIsCountryAbbreviation
TRUE if the string is a country abbreviation (per the locale data).
composed example
o1 = new stzString("banana split")
? o1.IsCountryAbbreviation()
#--> 0composed from the signature, run for this page no extensionIsCountryNumber
TRUE if the string is a numeric country code (per the locale data).
also written: IsCountryCodecomposed example
o1 = new stzString("banana split")
? o1.IsCountryNumber()
#--> 0composed from the signature, run for this page no extensionIsCountryPhoneCode
TRUE if the string is a country phone code.
composed example
o1 = new stzString("banana split")
? o1.IsCountryPhoneCode()
#--> 0composed from the signature, run for this page no extensionIsLanguageName
TRUE if the string names a language (per the locale data).
composed example
o1 = new stzString("banana split")
? o1.IsLanguageName()
#--> 0composed from the signature, run for this page no extensionIsLanguageNumber
TRUE if the string is a numeric language code.
also written: IsLanguageCodecomposed example
o1 = new stzString("banana split")
? o1.IsLanguageNumber()
#--> 0composed from the signature, run for this page no extensionTRUE if the string is a language abbreviation.
2 examples run? StzStringQ("ar").IsLanguageAbbreviation()
? IsLanguageAbbreviation("ar")
#--> 1
#--> 1library testno extensionTRUE if the string has an ISO locale shape (like en-US).
2 examples runo1 = new stzString("ar_Arab_TN")
# well formed
? o1.IsLocaleAbbreviation()
#--> 1library testno extensionIsCurrencyName
TRUE if the string names a currency (per the locale data).
composed example
o1 = new stzString("banana split")
? o1.IsCurrencyName()
#--> 0composed from the signature, run for this page no extensionIsCurrencySymbol
Currency-symbol check (stub: the monolith left it TODO; completes with the locale data).
composed example
o1 = new stzString("banana split")
? o1.IsCurrencySymbol()
#--> 0composed from the signature, run for this page no extensionTRUE if the string names a script (per the locale data).
2 examples runalso written: IsScript# yes
? StzStringQ("latin").IsScriptName()
#--> 1library testno extensionTRUE if the string is a script code.
1 examples runalso written: IsScriptNumbercomposed example
o1 = new stzString("banana split")
? o1.IsScriptCode()
#--> 0composed from the signature, run for this page no extensionTRUE if the string is a script abbreviation.
1 examples runcomposed example
o1 = new stzString("banana split")
? o1.IsScriptAbbreviation()
#--> 0composed from the signature, run for this page no extensionContainsOneOccurrence
Same as ContainsOneOccurrenceCS: TRUE if the substring occurs EXACTLY once.
also written: ContainsOne · ContainsOnlyOnecomposed example
o1 = new stzString("banana split")
? o1.ContainsOneOccurrence("an")
#--> 0composed from the signature, run for this page QCSXTZZZIBWUSame as ContainsNTimesCS: TRUE if the substring occurs exactly n times.
2 examples run? Q("ar_arab_tn").ContainsNTimes(2,"_")
#--> 1library testQCSXTZZZIBWURepresentsInteger
TRUE if the string is an integer literal.
also written: RepresentsCalculableIntegercomposed example
o1 = new stzString("banana split")
? o1.RepresentsInteger()
#--> 0composed from the signature, run for this page no extensionRepresentsSignedInteger
TRUE if the string is a SIGNED integer literal.
composed example
o1 = new stzString("banana split")
? o1.RepresentsSignedInteger()
#--> 0composed from the signature, run for this page no extensionRepresentsUnsignedInteger
TRUE if the string is an UNSIGNED integer literal.
composed example
o1 = new stzString("banana split")
? o1.RepresentsUnsignedInteger()
#--> 0composed from the signature, run for this page no extensionTRUE if the string is a real-number literal (carries a fractional dot).
2 examples runalso written: IsRealInString · IsARealInString · RepresentsRealInString · RepresentsCalculableRealNumber# yes
? Q("12500543.12").RepresentsRealNumber()
#--> 1library testno extensionRepresentsSignedNumber
TRUE if the string is a SIGNED number literal.
composed example
o1 = new stzString("banana split")
? o1.RepresentsSignedNumber()
#--> 0composed from the signature, run for this page no extensionRepresentsUnsignedNumber
TRUE if the string is an UNSIGNED number literal.
composed example
o1 = new stzString("banana split")
? o1.RepresentsUnsignedNumber()
#--> 0composed from the signature, run for this page no extensionTRUE if the string holds a numeric literal.
3 examples run# IsNumberInString on a space
? Q(" ").IsNumberInString()
#--> 0library testno extensionTRUE if the string holds a list literal (normal or computable form).
3 examples run# a bracketed list
? StzStringQ("[ 2, 3, 5:7 ]").IsListInString()
# a char range
? StzStringQ("'A':'F'").IsListInString()
#--> 1
#--> 1library testno extensionFilledWith
FilledWith(pItem): for an empty (or any) wrapped string, set the content to the string form of pItem and return it. Used for the 'start from an empty stzString and fill it with this value' fluent shape.
composed example
o1 = new stzString("banana split")
? o1.FilledWith("a")
#--> acomposed from the signature, run for this page QCSXTZZZIBWUToList
ToList: if the string represents a Haro list literal ("[1,2,3]"), eval it into the actual list. Otherwise returns the chars. Used by stzSmallFuncs.StzN to count list-in-string elements.
composed example
o1 = new stzString("banana split")
? @@( o1.ToList() )
#--> [ "b", "a", "n", "a", "n", "a", " ", "s", "p", "l", "i", "t" ]composed from the signature, run for this page QCSXTZZZIBWUTRUE if the string is a valid number literal (any base form).
2 examples runalso written: RepresentsCalculableNumbercomposed example
o1 = new stzString("banana split")
? o1.RepresentsNumber()
#--> 0composed from the signature, run for this page no extensionTRUE if the string is a decimal number literal.
1 examples runalso written: RepresentsNumberInDecimalFormcomposed example
o1 = new stzString("banana split")
? o1.RepresentsDecimalNumber()
#--> 0composed from the signature, run for this page no extensionTRUE if the string is a binary number literal.
2 examples runalso written: RepresentsNumberInBinaryForm# plain
? Q("0b110001.1001").RepresentsNumberInBinaryForm()
# signed before the prefix
? Q("-0b110001.1001").RepresentsNumberInBinaryForm()
# sign inside: malformed
? Q("0b-110001.1001").RepresentsNumberInBinaryForm()
#--> 1
#--> 1
#--> 0library testno extensionTRUE if the string is a hexadecimal number literal.
2 examples runalso written: RepresentsNumberInHexForm# hex form
? Q("x4E992").RepresentsNumberInHexForm()
#--> 1library testno extensionTRUE if the string is an octal number literal.
2 examples runalso written: RepresentsNumberInOctalForm# octal form
? Q("o01234567").RepresentsNumberInOctalForm()
#--> 1library testno extensionIsBlank
TRUE if the string is empty or whitespace only.
composed example
o1 = new stzString("banana split")
? o1.IsBlank()
#--> 0composed from the signature, run for this page no extensionIsIdentifier
TRUE if the string is a valid identifier (letter or underscore first, then letters, digits, underscores).
composed example
o1 = new stzString("banana split")
? o1.IsIdentifier()
#--> 0composed from the signature, run for this page no extensionIsBalanced
TRUE if the brackets and parentheses in the string are balanced.
composed example
o1 = new stzString("banana split")
? o1.IsBalanced()
#--> 1composed from the signature, run for this page no extensionIsNestedUsing
Different from IsBalanced (which only checks balance of opens and closes) -- this answers whether the structure has any proper nesting depth >= 2.
composed example
o1 = new stzString("banana split")
? o1.IsNestedUsing("an", "an")
#--> 1composed from the signature, run for this page no extensionIsNested
TRUE if the string's bounds nest (bounded regions inside bounded regions).
composed example
o1 = new stzString("banana split")
? o1.IsNested()
#--> 0composed from the signature, run for this page no extensionIsEmailLike
TRUE if the string looks like an email address.
composed example
o1 = new stzString("banana split")
? o1.IsEmailLike()
#--> 0composed from the signature, run for this page no extensionIsUrlLike
TRUE if the string looks like a URL.no extension
IsPangram
TRUE if the string uses every letter of the alphabet (a pangram).
composed example
o1 = new stzString("banana split")
? o1.IsPangram()
#--> 0composed from the signature, run for this page no extensionIsIsogram
TRUE if no char repeats in the string (an isogram).
composed example
o1 = new stzString("banana split")
? o1.IsIsogram()
#--> 0composed from the signature, run for this page no extensionIsWord
TRUE if the string is a single word.
composed example
o1 = new stzString("banana split")
? o1.IsWord()
#--> 0composed from the signature, run for this page no extensionTRUE if the string is a single letter.
2 examples run# * is not a letter, computationally
? NOT Q("*").IsLetter()
# ... and linguistically
? Q("*").IsNotLetter()
#--> 1
#--> 1library testno extensionIsADigit
TRUE if the string is a single digit.
composed example
o1 = new stzString("banana split")
? o1.IsDigit()
#--> 0composed from the signature, run for this page · written IsADigit() in the library today: the host language already holds IsDigit(), and Haro removes the detour no extensionTRUE if the string starts with a repeated char run.
1 examples runcomposed example
o1 = new stzString("banana split")
? o1.HasLeadingChars()
#--> 0composed from the signature, run for this page QCSXTZZZIBWUTRUE if the string ends with a repeated char run.
2 examples runcomposed example
o1 = new stzString("banana split")
? o1.HasTrailingChars()
#--> 0composed from the signature, run for this page QCSXTZZZIBWUHasLeadingAndTrailingChars
TRUE if the string both starts AND ends with repeated char runs.
composed example
o1 = new stzString("banana split")
? o1.HasLeadingAndTrailingChars()
#--> 0composed from the signature, run for this page no extensionIsReversedCopyOf
Same as IsReversedCopyOfCS: TRUE if the string is the reverse of the given one.
composed example
o1 = new stzString("banana split")
? o1.IsReversedCopyOf("an")
#--> 0composed from the signature, run for this page QCSXTZZZIBWUContainsLatin
TRUE if the string contains Latin chars.
composed example
o1 = new stzString("banana split")
? o1.ContainsLatin()
#--> 1composed from the signature, run for this page no extensionContainsArabic
TRUE if the string contains Arabic chars.
composed example
o1 = new stzString("banana split")
? o1.ContainsArabic()
#--> 0composed from the signature, run for this page no extensionContainsChar
Same as ContainsCharCS: TRUE if the string contains the given char.
composed example
o1 = new stzString("banana split")
? o1.ContainsChar("an")
#--> 1composed from the signature, run for this page QCSXTZZZIBWUContainsAnyOfChars
Same as ContainsAnyOfCharsCS: contains char / any / all
composed example
o1 = new stzString("banana split")
? o1.ContainsAnyOfChars("an")
#--> 1composed from the signature, run for this page QCSXTZZZIBWUContainsAllOfChars
Same as ContainsAllOfCharsCS: contains char / any / all
composed example
o1 = new stzString("banana split")
? o1.ContainsAllOfChars("an")
#--> 1composed from the signature, run for this page QCSXTZZZIBWUContainsOnlyChars
Same as ContainsOnlyCharsCS: contains char / any / all
composed example
o1 = new stzString("banana split")
? o1.ContainsOnlyChars("an")
#--> 0composed from the signature, run for this page QCSXTZZZIBWUFindInvisibleChars
The positions of the invisible chars.no extension
InvisibleChars
The invisible chars of the string, as a list.no extension
ContainsInvisibleChars
TRUE if the string contains invisible chars.
composed example
o1 = new stzString("banana split")
? o1.ContainsInvisibleChars()
#--> 1composed from the signature, run for this page no extensionIsControl
TRUE if the string is made of control chars.
composed example
o1 = new stzString("banana split")
? o1.IsControl()
#--> 0composed from the signature, run for this page no extensionHasMark
control / mark checks
composed example
o1 = new stzString("banana split")
? o1.HasMark()
#--> 0composed from the signature, run for this page no extensionCharIsControlAt
control / mark checks
composed example
o1 = new stzString("banana split")
? o1.CharIsControlAt(2)
#--> 0composed from the signature, run for this page no extensionCharIsMarkAt
control / mark checks
composed example
o1 = new stzString("banana split")
? o1.CharIsMarkAt(2)
#--> 0composed from the signature, run for this page no extensionCharIsSpaceAt
control / mark checks
composed example
o1 = new stzString("banana split")
? o1.CharIsSpaceAt(2)
#--> 0composed from the signature, run for this page no extensionOnlyMarks
only marks / controlsno extension
OnlyControls
only marks / controlsno extension
OnlyLatinLetters
only marks / controls
composed example
o1 = new stzString("banana split")
? o1.OnlyLatinLetters()
#--> bananasplitcomposed from the signature, run for this page no extensionIsNumericString
TRUE if the string is numeric.
also written: IsANumbercomposed example
o1 = new stzString("banana split")
? o1.IsNumericString()
#--> 0composed from the signature, run for this page no extensionIsAlphaString
numeric / alpha checks
also written: IsAllLetterscomposed example
o1 = new stzString("banana split")
? o1.IsAlphaString()
#--> 0composed from the signature, run for this page no extensionMatchesRegex
TRUE if the string matches the given regex pattern.
also written: IsMatchedByRegexcomposed example
o1 = new stzString("banana split")
? o1.MatchesRegex("an")
#--> 1composed from the signature, run for this page QCSXTZZZIBWUENGINE-BACKED (StzEngineStringSubStrings): all substrings in (i,j) order, no dedup. Retires the O(n^2) Haro double-loop.
5 examples runalso written: Substrinks · Substrongso1 = new stzString("RINGORIALAND")
# there are 12*13/2 = 78 substrings
? o1.NumberOfSubStrings()
# SubStrings() returns that many
? len( o1.SubStrings() )
#--> 78
#--> 78library testQCSXTZZZIBWUWFHow many substrings the string yields.
4 examples runalso written: HowManySubStringso1 = new stzString("..ONE..TWO..ONE..")
# all substrings
? o1.NumberOfSubStrings()
# unique substrings
? o1.NumberOfUniqueSubStrings()
#--> 153
#--> 120library testQCSXTZZZIBWUUniqueSubStrings
Same as SubStringsU: Same as SubStringsCS: ENGINE-BACKED (StzEngineStringSubStringsUniqueCS): dedup, first-seen order. cs=1 exact, cs=0 case-insensitive. Retires the O(n^3) loop.no extension
How many DISTINCT substrings the string yields.
1 examples runo1 = new stzString("..ONE..TWO..ONE..")
# all substrings
? o1.NumberOfSubStrings()
# unique substrings
? o1.NumberOfUniqueSubStrings()
#--> 153
#--> 120library testno extensionIndexOf
(no comment in the source: the name reads as a sentence) index ofin the section finder delegations (expanded)composed example
o1 = new stzString("banana split")
? o1.IndexOf("an")
#--> 2composed from the signature, run for this page QCSXTZZZIBWU FindAllChar
(no comment in the source: the name reads as a sentence) find all charin the section finder delegations (expanded)composed example
o1 = new stzString("banana split")
? @@( o1.FindAllChar("an") )
#--> [ 2, 4, 6 ]composed from the signature, run for this page no extension StartsWithAny
Same as StartsWithAnyCS: TRUE if the string starts with ANY of the given prefixes.
composed example
o1 = new stzString("banana split")
? o1.StartsWithAny("an")
#--> 0composed from the signature, run for this page QCSXTZZZIBWUEndsWithAny
(no comment in the source: the name reads as a sentence) ends with anyin the section finder delegations (expanded)composed example
o1 = new stzString("banana split")
? o1.EndsWithAny("an")
#--> 0composed from the signature, run for this page QCSXTZZZIBWU FindBetweenAsSection
(no comment in the source: the name reads as a sentence) find between as sectionin the section finder delegations (expanded)composed example
o1 = new stzString("banana split")
? @@( o1.FindBetweenAsSection("an", "an") )
#--> [ 3, 4 ]composed from the signature, run for this page QCSXTZZZIBWU FindBetweenAsSections
FindBetweenAsSections takes EITHER 2 or 3 args (Haro lacks optional params), so the 3-arg form lives at a separate method name -- the alias below accepts both via Haro's lookup rules.no extension
FindBoundedByAsSections
Same as FindBoundedByAsSectionsCS: The [start, end] sections of the substrings bounded by the given bounds.
composed example
o1 = new stzString("banana split")
? @@( o1.FindBoundedByAsSections([ "an", "a" ]) )
#--> [ [ 4, 3 ], [ 6, 5 ] ]composed from the signature, run for this page QCSXTZZZIBWUFindAnyBoundedByAsSections
The [start, end] sections of the substrings bounded by any of the given bounds.
composed example
o1 = new stzString("banana split")
? @@( o1.FindAnyBoundedByAsSections([ "an", "a" ]) )
#--> [ [ 4, 3 ], [ 6, 5 ] ]composed from the signature, run for this page QCSXTZZZIBWUFindAnyBoundedBy
FindAnyBoundedBy(pacBounds): single-arg form. Accepts a list [open, close] or a single string used for both ends.
composed example
o1 = new stzString("banana split")
? @@( o1.FindAnyBoundedBy([ "an", "a" ]) )
#--> [ 4 ]composed from the signature, run for this page QCSXTZZZIBWUFindAnyBoundedByIBAsSections
Same as FindSubStringsBoundedByIBZZ: FindSubStringsBoundedByIBZZ: for every substring bounded by pacBounds[1]..pacBounds[2] return the [startPos, endPos] pairs INCLUDING the bounds (IB = inclusive bounds). Ported from archive line 34794; self-contained scan rather than the SectionsBetween-based archive version.
composed example
o1 = new stzString("banana split")
? @@( o1.FindAnyBoundedByIBAsSections([ "an", "a" ]) )
#--> [ [ 2, 4 ] ]composed from the signature, run for this page no extensionDeepFindBoundedByZZ
The [start, end] sections of the bounded substrings at EVERY nesting depth.
also written: DeepFindSubStringsZZ · DeepFindSubStringsBoundedByZZcomposed example
o1 = new stzString("banana split")
? @@( o1.DeepFindBoundedByZZ([ "an", "a" ]) )
#--> [ [ 6, 5 ] ]composed from the signature, run for this page no extensionDeepBoundedBy
The bounded substrings at every nesting depth.QCSXTZZZIBWU
DeepSubStringsZZ
The nested bounded substrings with their [start, end] sections.
also written: DeepSubStringsBoundedByZZcomposed example
o1 = new stzString("banana split")
? @@( o1.DeepSubStringsZZ([ "an", "a" ]) )
#--> [ [ "", [ 6, 5 ] ] ]composed from the signature, run for this page no extensionDeepFindBoundedByIBZZ
The nested bounded sections, bounds INCLUDED (IB).
also written: DeepFindSubStringsBoundedByIBZZcomposed example
o1 = new stzString("banana split")
? @@( o1.DeepFindBoundedByIBZZ([ "an", "a" ]) )
#--> [ [ 4, 6 ] ]composed from the signature, run for this page no extensionDeepSubStringsBoundedByIBZZ
The nested bounded substrings, bounds included, with their sections.
composed example
o1 = new stzString("banana split")
? @@( o1.DeepSubStringsBoundedByIBZZ([ "an", "a" ]) )
#--> [ [ "ana", [ 4, 6 ] ] ]composed from the signature, run for this page no extensionNestedSubStrings
The bounded substrings including the NESTED ones.QCSXTZZZIBWU
RemoveSubStringsBoundedByIB
RemoveSubStringsBoundedByIB([o,c]): drop every bounded region together with -- its bounds (e.g. removing the "]---[" runs from "Hello ]---[Haro!]---[" -> -- "Hello Haro!"). MUTATING; returns This.QCSXTZZZIBWU
FindSubStringsAsSectionsW(pcCondition): enumerate every substring [start, end] and return the sections where the @SubString predicate is TRUE. Engine-backed (stzList.FindW over the candidates), no eval(). FindSubStringsAsSectionsW(pcCondition): the [start,end] sections of every substring matching the predicate. Engine-backed -- enumerates the candidate substrings and evaluates the @SubString predicate via the list W-DSL (stzList.FindW, predicate normalized: { } stripped, @SubString -> @item, Q().Method() lowered), with NO eval(). For engine-expressible predicates (=, or, and, comparisons); for richer ones use the WF form below. Replaces the retired raw-eval FindSubStringsAsSectionsWXT.
1 examples run# the length-4 sections containing a heart pair
? @@( Q("..♥^^♥..^♥♥^..").FindSubStringsAsSectionsWF( func s { return Q(s).NumberOfChars() = 4 and Q(s).ContainsCS("♥♥", 1) } ) )
#--> [ [ 8, 11 ], [ 9, 12 ], [ 10, 13 ] ]library testQCSXTZZZIBWUFThe positions of the substrings satisfying the W condition.
1 examples run# the matching substrings
? @@( Q("...ONE...TWO...ONE").FindSubStringsW('{ @SubString = "ONE" or @SubString = "TWO" }') )
# FindSubStringsWZZ gives their sections
? @@( Q("...ONE...TWO...ONE").FindSubStringsWZZ('{ @SubString = "ONE" or @SubString = "TWO" }') )
#--> [ "ONE", "TWO", "ONE" ]
#--> [ [ 4, 6 ], [ 10, 12 ], [ 16, 18 ] ]library testQCSXTZZZIBWUFFindSubStringsMadeOf
FindSubStringsMadeOf(pcChar): return the start positions of each MAXIMAL run of pcChar in the content. e.g. "..._...__" with pcChar="_" -> [4, 8]. "Made of" runs: the arg is a POOL of chars ("12" = chars 1 and 2), and a run is a maximal stretch whose every char belongs to the pool.
also written: FindMadeOfcomposed example
o1 = new stzString("banana split")
? @@( o1.FindSubStringsMadeOf("an") )
#--> [ 2 ]composed from the signature, run for this page QCSXTZZZIBWUFindNthOccurrenceCS / FindNthOccurrence: n-th match of pcSub inside the content. Engine-backed. (case-sensitive by default)
1 examples runcomposed example
o1 = new stzString("banana split")
? o1.FindNthOccurrence(2, "an")
#--> 4composed from the signature, run for this page QCSXTZZZIBWUAllPositionsOf
All positions of pcSub (collect-them-all helper).
also written: FindMarker · FindMarquer · OccurrencesOfMarquercomposed example
o1 = new stzString("banana split")
? @@( o1.AllPositionsOf("an") )
#--> [ 2, 4 ]composed from the signature, run for this page no extensionFindFirstNOccurrences
FindFirstNOccurrences(n, pcSub): the first n positions where pcSub appears in the content.
composed example
o1 = new stzString("banana split")
? @@( o1.FindFirstNOccurrences(2, "an") )
#--> [ 2, 4 ]composed from the signature, run for this page no extensionFindLastNOccurrences
FindLastNOccurrences(n, pcSub): the last n positions.
composed example
o1 = new stzString("banana split")
? @@( o1.FindLastNOccurrences(2, "an") )
#--> [ 2, 4 ]composed from the signature, run for this page no extensionHowMany family: count occurrences of pcSub in the content.
2 examples runcomposed example
o1 = new stzString("banana split")
? o1.HowMany("an")
#--> 2composed from the signature, run for this page QCSXTZZZIBWUSTHow long the trailing char run is.
1 examples runcomposed example
o1 = new stzString("banana split")
? o1.HowManyTrailingChar()
#--> 0composed from the signature, run for this page no extensionHowManyLeadingChar
How long the leading char run is.
composed example
o1 = new stzString("banana split")
? o1.HowManyLeadingChar()
#--> 0composed from the signature, run for this page no extensionHowManyOccurrenceOfCharRightSide
HowManyOccurrenceOfCharRightSide(pcChar) / EndSide: count the trailing run of pcChar.
also written: HowManyOccurrenceOfCharEndSide · NumberOfOccurrenceOfCharEndSide · NumberOfOccurrenceOfCharRightSide · NumberOfOccurrenceOfCharEndingSidecomposed example
o1 = new stzString("banana split")
? o1.HowManyOccurrenceOfCharRightSide("an")
#--> 0composed from the signature, run for this page no extensionHowManyOccurrenceOfCharLeftSide
How many times the char repeats at the START of the string.
also written: HowManyOccurrenceOfCharStartSide · NumberOfOccurrenceOfCharLeftSide · NumberOfOccurrenceOfCharStartSide · NumberOfOccurrenceOfCharStartingSidecomposed example
o1 = new stzString("banana split")
? o1.HowManyOccurrenceOfCharLeftSide("an")
#--> 0composed from the signature, run for this page no extensionSubStringsMadeOf
SubStringsMadeOf(pcChar): the actual matching substrings (each maximal run as a single string).
composed example
o1 = new stzString("banana split")
? @@( o1.SubStringsMadeOf("an") )
#--> [ "anana" ]composed from the signature, run for this page QCSXTZZZIBWUFindSubStringBoundsUpToNCharsAsSections
FindSubStringBoundsUpToNCharsAsSections(pcSub, n) -- for each occurrence of pcSub, return the [startBefore, endBefore] section of up to n chars to its LEFT and the [startAfter, endAfter] section of up to n chars to its RIGHT. Returns a flat list of all such sections.
also written: FindSubStringBoundsUpToNCharscomposed example
o1 = new stzString("banana split")
? @@( o1.FindSubStringBoundsUpToNCharsAsSections("an", 2) )
#--> [ [ 1, 1 ], [ 4, 5 ], [ 2, 3 ], [ 6, 7 ] ]composed from the signature, run for this page no extensionFindSubStringsBoundedBy(pacBounds): return the starting positions of each substring that sits between the open / close bounds. The bounds list may use the [open, :And = close] DSL shape or a plain [open, close] / single string for both ends.
1 examples runcomposed example
o1 = new stzString("banana split")
? @@( o1.FindSubStringsBoundedBy([ "an", "a" ]) )
#--> [ 4 ]composed from the signature, run for this page QCSXTZZZIBWUFindSubStringsBetween
Find the substrings lying between the two given bounds.
composed example
o1 = new stzString("banana split")
? @@( o1.FindSubStringsBetween("an", "an") )
#--> [ 4 ]composed from the signature, run for this page QCSXTZZZIBWUFindSubStringBoundedBy
FindSubStringBoundedBy(pcWhat, pacBounds): return positions (only inside bounded sections) where pcWhat appears.QCSXTZZZIBWU
FindSubStringBoundedByAsSections
Same as FindSubStringBoundedByZZ: FindSubStringBoundedBy(pcWhat, pacBounds): return positions (only inside bounded sections) where pcWhat appears. (answers [start, end] sections)no extension
FindBoundedSubString
FindBoundedSubString(pcSub): the start positions of the occurrences of pcSub that carry non-space bound runs on BOTH sides (a 2-list arg keeps the legacy BoundedBy behavior).
composed example
o1 = new stzString("banana split")
? @@( o1.FindBoundedSubString("an") )
#--> [ 2, 4 ]composed from the signature, run for this page QCSXTZZZIBWUFindBoundedSubStrings
Find the bounded substrings (polymorphic: one substring or an [open, close] pair).
composed example
o1 = new stzString("banana split")
? @@( o1.FindBoundedSubStrings("an") )
#--> [ [ 2, 3 ], [ 4, 5 ] ]composed from the signature, run for this page QCSXTZZZIBWUFindSubStringBounds
FindSubStringBounds(pcSub): the FLAT start positions of the bound runs (left then right, per bounded occurrence, in order).
composed example
o1 = new stzString("banana split")
? @@( o1.FindSubStringBounds("an") )
#--> [ 1, 4, 3, 6 ]composed from the signature, run for this page QCSXTZZZIBWURemoveTrailingSubString
Same as RemoveTrailingChars: Drop the whole trailing run of the string's last char (mutating).
composed example
o1 = new stzString("banana split")
o1.RemoveTrailingSubString()
? o1.Content()
#--> banana splicomposed from the signature, run for this page QCSXTZZZIBWUFind the position of the next n-th marker after nFrom.
1 examples runalso written: FindNextNthMarkercomposed example
o1 = new stzString("banana split")
? o1.FindNextNthMarquer(2, 5)
#--> 0composed from the signature, run for this page QCSXTZZZIBWUSTContainsSubStringBoundedBy(pcSub, pacBounds): TRUE if pcSub appears inside any bounded section.
1 examples run# '♥♥♥' is enclosed by '^^' .. '^^'
? Q("^^♥♥♥^^").ContainsSubStringBoundedBy("♥♥♥", [ "^^", "^^" ])
#--> 1library testQCSXTZZZIBWUFindAsSectionsStD
(Haro is case-insensitive; one method name covers StD / STD.)
composed example
o1 = new stzString("banana split")
? @@( o1.FindAsSectionsStD("an", 2, :Forward) )
#--> [ [ 2, 3 ], [ 4, 5 ] ]composed from the signature, run for this page no extensionHexUnicodes
HexUnicodes(): hex codepoints for every char, returned as a list.
also written: HexUnicodes_aliascomposed example
o1 = new stzString("banana split")
? @@( o1.HexUnicodes() )
#--> [ "U+0062", "U+0061", "U+006E", "U+0061", "U+006E", "U+0061", "U+0020", "U+0073", "U+0070", "U+006C", "U+0069", "U+0074" ]composed from the signature, run for this page no extensionFirst2CharsAsString
First2CharsAsString / Last2CharsAsString: aliases.
composed example
o1 = new stzString("banana split")
? o1.First2CharsAsString()
#--> bacomposed from the signature, run for this page no extensionLast2CharsAsString
The last two chars, as a string.
composed example
o1 = new stzString("banana split")
? o1.Last2CharsAsString()
#--> itcomposed from the signature, run for this page no extensionRemoveSpacesQ_alias
RemoveSpacesQ on stzString -- fluent form (existing RemoveSpaces at line ~6094 isn't followed by a Q form). Wrap and return This.no extension
SpacifySections(aSections [, pcSep]): insert pcSep between every pair of consecutive chars inside each [n1, n2] section. pcSep defaults to " " when the second arg is omitted.
1 examples runo1 = new stzString("Ringprogramminglanguageispowerful!")
o1.SpacifySections([ [ 5, 15 ], [ 24, 25 ] ])
# each section's chars are spaced out
? o1.Content()
#--> Ringp r o g r a m m i n glanguagei spowerful!library testQCSXTZZZIBWUShrink(): trim leading + trailing whitespace. Shrink([p1]): Shrink() : Trim Shrink(:ToPosition = N) : keep first N chars Shrink(N) : keep first N chars Implemented as 1-arg with optional sentinel NULL/empty for trim.
1 examples runo1 = new stzString("ABCDE")
o1.Shrink( :ToPosition = 3 )
# 'ABCDE' shrunk to position 3
? o1.Content()
#--> ABClibrary testQCSXTZZZIBWUShortenN(n): same as ShortenedN but mutates in place.
1 examples runcomposed example
o1 = new stzString("banana split")
o1.ShortenN(2)
? o1.Content()
#--> ba...itcomposed from the signature, run for this page QCSXTZZZIBWUContainsInSections(pcSub, aSections): TRUE if pcSub appears inside ANY of the listed sections.
1 examples runo1 = new stzString("123♥♥678♥♥1234♥♥789")
# '♥' is inside section 3..10
? o1.ContainsInSection("♥", 3, 10)
# '♥' is inside all three sections
? o1.ContainsInSections("♥", [ [3,10], [8,12], [14,19] ])
#--> 1
#--> 1library testno extensionContainsBefore(pcSub, pcAnchor | :Position = n | :SubString = s): TRUE iff pcSub appears in the content BEFORE the anchor.
1 examples runcomposed example
o1 = new stzString("banana split")
? o1.ContainsBefore("an", "an")
#--> 0composed from the signature, run for this page no extensionTRUE if pcSub occurs AFTER the anchor substring.
1 examples runcomposed example
o1 = new stzString("banana split")
? o1.ContainsAfter("an", "an")
#--> 1composed from the signature, run for this page no extensionContainsOnlyOneOfThese(paSubStr): TRUE iff EXACTLY ONE of the listed substrings appears in the content (counting at least one occurrence as 1).
1 examples runcomposed example
o1 = new stzString("banana split")
? o1.ContainsOnlyOneOfThese([ "an", "a" ])
#--> 0composed from the signature, run for this page no extensionIsReverseOf
IsReverseOf(pcOther): TRUE iff This.Content() is the reverse of pcOther (codepoint-by-codepoint).
composed example
o1 = new stzString("banana split")
? o1.IsReverseOf("an")
#--> 0composed from the signature, run for this page no extensionHexUnicode
HexUnicode(): hex form of the codepoint (e.g. "A" -> "0041"). When the content is a single char, returns its codepoint hex; otherwise the codepoint of the first char.
composed example
o1 = new stzString("banana split")
? o1.HexUnicode()
#--> U+0062composed from the signature, run for this page no extensionFirst2Chars
The first two chars, as a list.
composed example
o1 = new stzString("banana split")
? @@( o1.First2Chars() )
#--> [ "b", "a" ]composed from the signature, run for this page no extensionLast2Chars
The last two chars, as a list.
composed example
o1 = new stzString("banana split")
? @@( o1.Last2Chars() )
#--> [ "i", "t" ]composed from the signature, run for this page no extensionLast3Chars
The last three chars, as a list.
composed example
o1 = new stzString("banana split")
? @@( o1.Last3Chars() )
#--> [ "l", "i", "t" ]composed from the signature, run for this page no extensionFirst3Chars
The first three chars, as a list.
composed example
o1 = new stzString("banana split")
? @@( o1.First3Chars() )
#--> [ "b", "a", "n" ]composed from the signature, run for this page no extensionThe first n chars, as a string.
1 examples runcomposed example
o1 = new stzString("banana split")
? o1.FirstNChars(2)
#--> bacomposed from the signature, run for this page no extensionThe last n chars, as a string.
1 examples runcomposed example
o1 = new stzString("banana split")
? o1.LastNChars(2)
#--> itcomposed from the signature, run for this page no extensionExtendToNChars(n): pad content with spaces up to length n.
1 examples runo1 = new stzString("ABC")
o1.ExtendToNChars(5)
# 'ABC' padded to width 5
? o1.Content()
#--> ABClibrary testQCSXTZZZIBWUSpacified / SpacifiedUsing / SpacifiedXT: non-mutating Spacify variants. Return the spaced-out string without altering This.
3 examples runalso named: add spaces between characters space out letter spacing# spaces between
? Q("SOFTANZA").Spacified()
#--> S O F T A N Z Alibrary testQCSXTZZZIBWUA copy with the chars separated by the given separator.
1 examples runo1 = new stzString("99999999999")
# Spacified() spaces the chars
? o1.Spacified()
# SpacifiedUsing('_') uses underscores
? o1.SpacifiedUsing("_")
#--> 9 9 9 9 9 9 9 9 9 9 9
#--> 9_9_9_9_9_9_9_9_9_9_9library testno extensionSpacifyTheseSubStrings(paSubStr [, pcSep]): wrap each occurrence of every substring in paSubStr with pcSep on each side. pcSep defaults to " " when the second arg is omitted.
1 examples runo1 = new stzString("MahmoudBertAhmedMansourIlirGalMajdi")
o1.SpacifyTheseSubStrings([
"Mahmoud", "Bert", "Ahmed", "Mansour", "Ilir", "Gal", "Majdi" ])
# the names separate with single spaces, no edge spaces
? o1.Content()
#--> Mahmoud Bert Ahmed Mansour Ilir Gal Majdilibrary testQCSXTZZZIBWUSplitAtSections
SplitAtSections(aSections): the pieces of content sliced by the listed [n1, n2] sections. Each section becomes one piece. SplitAtSections(aSections): split AT the sections -- return the COMPLEMENT parts between them (the original monolith routes the complement computation through stzSplitter).no extension
SplitAtCharsW(pcCondition): split content at every char where the predicate is TRUE. Same semantics as SplitW, spelled for char-narratives.
1 examples run# SplitAtCharsW
? @@( Q("RingRingRing").SplitAtCharsW('Q(@char).IsUppercase()') )
# SplitW(:AtChars) is the same
? @@( Q("RingRingRing").SplitW(:AtChars = 'Q(@char).IsUppercase()') )
#--> [ "ing", "ing", "ing" ]
#--> [ "ing", "ing", "ing" ]library testno extensionCommonSubStrings
CommonSubStrings(:With = pcOther): substrings appearing in both This and pcOther (set-style intersection at the char-substring level, capped at the smaller string's substring count).no extension
EndsWithNumberN(pcNumStr): TRUE if the content ENDS with the given number-as-string. Accepts optional leading sign in pcNumStr.
3 examples runalso written: EndsWithThisNumbercomposed example
o1 = new stzString("banana split")
? o1.EndsWithNumberN("an")
#--> 0composed from the signature, run for this page no extension(EndsWithNumber zero-arg form already exists above as nested alias; the 1-arg "ends with this number" variant is reachable via EndsWithNumberN.) TheseBoundsRemoved(pcOpen, pcClose): return the content with pcOpen stripped from start and pcClose from end (only when both are present in those positions).
3 examples runo1 = new stzString("<<Go!>>")
# the bounds fall away
? o1.TheseBoundsRemoved("<<", ">>")
#--> Go!library testQCSXTZZZIBWURemoveEmptyLines
RemoveEmptyLines / RemoveEmptyLinesQ: drop lines that are empty (after trim).QCSXTZZZIBWU
TRUE if the string's dominant script is the given one.
2 examples runalso written: IsScriptOf# spaces are Common
? StzStringQ(" ").IsScriptOf(:Common)
# a dhammah is Inherited
? StzStringQ(ArabicDhammah()).IsScriptOf(:Inherited)
#--> 1
#--> 1library testno extensionRemoveAt
RemoveAt -- two shapes: RemoveAt(n) -- remove single char at position n RemoveAt(n, pcSub) -- remove pcSub at position n
composed example
o1 = new stzString("banana split")
o1.RemoveAt(2, "an")
? o1.Content()
#--> bana splitcomposed from the signature, run for this page QCSXTZZZIBWUIsQuietEqualTo(pcOther): "quiet" equality -- accept up to ~30% char-level mismatches. Useful for fuzzy comparisons. Uses Levenshtein-style distance with simple thresholding.
3 examples runcomposed example
o1 = new stzString("banana split")
? o1.IsQuietEqualTo("an")
#--> 0composed from the signature, run for this page no extensionNextOccurrence(pcSub, nFrom): position of the next occurrence of pcSub strictly after nFrom.
2 examples runo1 = new stzString("12500;NAME;10;0")
# the next one from 1
? o1.NextOccurrence( :Of = ";", :StartingAt = 1 )
# the 2nd from 5
? o1.NextNthOccurrence( 2, :Of = ";", :StartingAt = 5)
#--> 6
#--> 11library testno extensionPreviousOccurrence
PreviousOccurrence(sub, nFrom): the last occurrence lying ENTIRELY before nFrom (the original searches Section(1, nFrom-1), so an occurrence overlapping nFrom does not count).
composed example
o1 = new stzString("banana split")
? o1.PreviousOccurrence("an", 2)
#--> 0composed from the signature, run for this page no extensionRepeatedLeadingChar(): the single char that begins a leading run of repeated chars (or "" if no run).
2 examples runo1 = new stzString("exeeeeeTUNIS")
# no repeated leading char
? o1.RepeatedLeadingChar()
# empty list
? len( o1.RepeatedLeadingChars() )
#--> 0library testno extensionRepeatedTrailingChar
The char repeated at the end of the string.no extension
NumberOfRepeatedLeadingChars
How long the repeated run at the start is.
composed example
o1 = new stzString("banana split")
? o1.NumberOfRepeatedLeadingChars()
#--> 0composed from the signature, run for this page no extensionNumberOfRepeatedTrailingChars
How long the repeated run at the end is.
composed example
o1 = new stzString("banana split")
? o1.NumberOfRepeatedTrailingChars()
#--> 0composed from the signature, run for this page no extensionSectionsOfSameItems
SectionsOfSameItems(): contiguous runs of equal chars as [start, end] sections.
composed example
o1 = new stzString("banana split")
? @@( o1.SectionsOfSameItems() )
#--> [ [ 1, 1 ], [ 2, 2 ], [ 3, 3 ], [ 4, 4 ], [ 5, 5 ], [ 6, 6 ], [ 7, 7 ], [ 8, 8 ], [ 9, 9 ], [ 10, 10 ], [ 11, 11 ], [ 12, 12 ] ]composed from the signature, run for this page QCSXTZZZIBWUReplaceAnyBoundedBy(pacBounds, pcNew): wrapper over the substrings-bounded-by-replace family.
2 examples runcomposed example
o1 = new stzString("banana split")
o1.ReplaceAnyBoundedBy([ "an", "a" ], "AN")
? o1.Content()
#--> banANana splitcomposed from the signature, run for this page QCSXTZZZIBWUReplaceManyPairs
(ReplaceMany 2-list form: per-index pcOld[i] -> pcNew[i] via the existing ReplaceMany above.)QCSXTZZZIBWU
AntiFindAsSection
AntiFindAsSection: alias for the singular form (just first section from AntiFindAsSections, or [] if none). AntiFindAsSection: the FIRST complement span (the first gap not covered by an occurrence of pcSub).
composed example
o1 = new stzString("banana split")
? @@( o1.AntiFindAsSection("an") )
#--> [ 1, 1 ]composed from the signature, run for this page no extensionTrailing/leading number helpers. TrailingNumber / LeadingNumber: decimal- and SIGN-aware, so "Amount: -132.45" trails "-132.45" and "-23.67 pounds" leads with "-23.67".
3 examples runalso written: EndingNumberno extensionThe number the string STARTS with, as a string (empty if none).
1 examples runalso written: StartingNumberno extensionNumberOfTrailingNumberDigits
How many digits the trailing number has.
composed example
o1 = new stzString("banana split")
? o1.NumberOfTrailingNumberDigits()
#--> 0composed from the signature, run for this page no extensionNumberOfLeadingNumberDigits
How many digits the leading number has.
composed example
o1 = new stzString("banana split")
? o1.NumberOfLeadingNumberDigits()
#--> 0composed from the signature, run for this page no extensionBounds
Bounds(pcOpen, pcClose): the [open, close] positions of the first bounded match. Two-arg form. Bounds(): auto-detect leading and trailing non-letter runs - e.g. "<<Haro>>" -> [ "<<", ">>" ], "---Ring___" -> [ "---", "___" ]. Falls back to [ firstchar, lastchar ] for fully alphanumeric input. Bounds(): auto-detect the leading/trailing bound. Each side is the maximal run of the SAME edge char (when it is a bound char), so "<<Go!>>" -> [ "<<", ">>" ] -- the "!" is content, NOT swallowed into the trailing bound (the old "any non-alpha" walk greedily took "!>>").
composed example
o1 = new stzString("banana split")
? @@( o1.Bounds() )
#--> [ "b", "t" ]composed from the signature, run for this page QCSXTZZZIBWUBoundsBetween
The [open, close] bounds found between the given pair.
composed example
o1 = new stzString("banana split")
? @@( o1.BoundsBetween("an", "an") )
#--> [ 2, 4 ]composed from the signature, run for this page no extensionHasRepeatedLeadingChars(): TRUE if the content begins with a run of identical chars (length >= 2).
1 examples runcomposed example
o1 = new stzString("banana split")
? o1.HasRepeatedLeadingChars()
#--> 0composed from the signature, run for this page no extensionHasRepeatedTrailingChars
TRUE if the string ends with a repeated char run.
composed example
o1 = new stzString("banana split")
? o1.HasRepeatedTrailingChars()
#--> 0composed from the signature, run for this page no extensionExcept
Except(pcSub): the content with all occurrences of pcSub removed.
composed example
o1 = new stzString("banana split")
? @@( o1.Except("an") )
#--> [ "b", "a split" ]composed from the signature, run for this page no extensionNth(n[, pcSub]): Nth(n) : the n-th char (1-based, codepoint-aware) Nth(n, pcSub) : position of the n-th occurrence of pcSub Negative n counts from the end (-1 = last).
1 examples runcomposed example
o1 = new stzString("banana split")
? o1.Nth(2, "an")
#--> 4composed from the signature, run for this page QCSXTZZZIBWUSTDNthChar1
The char at position n (lenient 1-based form).
composed example
o1 = new stzString("banana split")
? o1.NthChar1(2)
#--> acomposed from the signature, run for this page no extensionLastNItemsQRT
(NthChar already exists earlier; just expose Nth alias above.) LastNItemsQRT(n, pcType): the last n items wrapped in pcType. stzString surface: forward to LastNChars + appropriate wrapper.
composed example
o1 = new stzString("banana split")
? o1.LastNItemsQRT(2, "an")
#--> itcomposed from the signature, run for this page no extensionFirstNItemsQRT
The first n chars, in the requested return type (QRT).
composed example
o1 = new stzString("banana split")
? o1.FirstNItemsQRT(2, "an")
#--> bacomposed from the signature, run for this page no extensionFindLastAsSection
FindLastAsSection: [start, end] of the last occurrence of pcSub.
also written: FindLasteAsSectioncomposed example
o1 = new stzString("banana split")
? @@( o1.FindLastAsSection("an") )
#--> [ 4, 5 ]composed from the signature, run for this page no extensionFindPrevious(pcSub, nFrom): mirror of NextOccurrence -- highest position strictly before nFrom.
6 examples runo1 = new stzString("[••[•[••]•[•]]••[••]]")
? o1.FindNext("[", :StartingAt = 17)
? o1.FindPrevious("]", :StartingAt = 13)
#--> 0
#--> 9library testno extensionThe position of the nth occurrence STRICTLY BEFORE the given position.
2 examples runcomposed example
o1 = new stzString("banana split")
? o1.FindPreviousNth(2, "an", 5)
#--> 2composed from the signature, run for this page no extensionLeftCharRemoved
LeftCharRemoved / RightCharRemoved: non-mutating singular.
composed example
o1 = new stzString("banana split")
? o1.LeftCharRemoved()
#--> anana splitcomposed from the signature, run for this page no extensionRightCharRemoved
A copy with the last (rightmost) char removed.
composed example
o1 = new stzString("banana split")
? o1.RightCharRemoved()
#--> banana splicomposed from the signature, run for this page no extensionCapitalCased(): first char uppercase, rest lowercase. CapitalCased(): TITLE case -- capitalise the first letter of EVERY word (engine ToTitle), per the original. (NOT sentence-case / first-letter-only.)
1 examples runcomposed example
o1 = new stzString("banana split")
? o1.CapitalCased()
#--> Banana Splitcomposed from the signature, run for this page no extensionCapitalCase
Capitalize the string in place (mutating). For a copy, use CapitalCased.QCSXTZZZIBWU
IsMadeOfNumbers(): TRUE if EVERY char is a digit.
1 examples runalso written: IsMadeOfDigits# '121212' is made of '12'
? Q("121212").IsMadeOf("12")
# '121212' is made of ['1','2']
? Q("121212").IsMadeOf([ "1", "2" ])
# '984332' is made of numbers
? Q("984332").IsMadeOfNumbers()
#--> 1
#--> 1
#--> 1library testno extensionIsMadeOfLetters
TRUE if the string is made of letters only.
composed example
o1 = new stzString("banana split")
? o1.IsMadeOfLetters()
#--> 0composed from the signature, run for this page no extensionSplitToPartsOfSizes
SplitToPartsOfSizes(anSizes): split into pieces of the given sizes.no extension
IsStepNamedParam
IsStepNamedParam(): TRUE if content is [:step, value]. Used by parser narratives.no extension
UpdateWith(pcNew): replace content with pcNew. Alias of Update.
1 examples runo1 = new stzString("999999999999")
o1.UpdateWith("999 999 999.999")
# the content becomes the new value
? o1.Content()
#--> 999 999 999.999library testQCSXTZZZIBWURemoveCharFromLeft(pcChar): drop leading chars matching pcChar.
1 examples runQCSXTZZZIBWURemoveCharFromRight
Drop the trailing chars matching pcChar from the end of the string (mutating).QCSXTZZZIBWU
NthAsSection
ItemsAndTheirNumberOfOccurrence(): per-char occurrence count returned as [ [char, count], ... ]. NthAsSection(n, pcSub): [start, end] of the n-th occurrence of pcSub.
composed example
o1 = new stzString("banana split")
? @@( o1.NthAsSection(2, "an") )
#--> [ 4, 5 ]composed from the signature, run for this page no extensionLeftBound
The opening (left) bound of the string.
composed example
o1 = new stzString("banana split")
? o1.LeftBound()
#--> bcomposed from the signature, run for this page no extensionRightBound
The closing (right) bound of the string.
composed example
o1 = new stzString("banana split")
? o1.RightBound()
#--> tcomposed from the signature, run for this page no extensionCharsInverted
CharsInverted: each char's case toggled.
composed example
o1 = new stzString("banana split")
? @@( o1.CharsInverted() )
#--> [ "B", "A", "N", "A", "N", "A", " ", "S", "P", "L", "I", "T" ]composed from the signature, run for this page no extensionInvertCharsCase
Swap the case of every char in place (mutating, engine-backed).no extension
ToStzTable
ToStzTable: stub returning content as a single-cell table.no extension
FindNextOccurrences
IsContiguousListInString: TRUE if content roughly matches `a:b` short-form list literal. FindNextOccurrences(:Of = pcSub, :StartingAt = N): positions of every occurrence of pcSub after position N.no extension
FindPreviousOccurrences
The previous occurrence of the substring from the given start position: the position(s).no extension
TRUE if the string holds a contiguous list, any form.
1 examples runcomposed example
o1 = new stzString("banana split")
? o1.IsContiguousListInString()
#--> 0composed from the signature, run for this page no extensionItemsAndTheirNumberOfOccurrence
Each char paired with how many times it occurs.
composed example
o1 = new stzString("banana split")
? @@( o1.ItemsAndTheirNumberOfOccurrence() )
#--> [ [ "b", 1 ], [ "a", 3 ], [ "n", 2 ], [ " ", 1 ], [ "s", 1 ], [ "p", 1 ], [ "l", 1 ], [ "i", 1 ], [ "t", 1 ] ]composed from the signature, run for this page no extensionLast3CharsAsString
The last three chars, as a string.
composed example
o1 = new stzString("banana split")
? o1.Last3CharsAsString()
#--> litcomposed from the signature, run for this page no extensionFirst3CharsAsString
The first three chars, as a string.
composed example
o1 = new stzString("banana split")
? o1.First3CharsAsString()
#--> bancomposed from the signature, run for this page no extensionNext3Chars
More codepoint convenience slices. Next3Chars(:StartingAt = n): the 3 chars AFTER position n (a LIST); Next3CharsAsString returns them as a substring.
composed example
o1 = new stzString("banana split")
? @@( o1.Next3Chars(3) )
#--> [ "a", "n", "a" ]composed from the signature, run for this page no extensionCharRemovedFromLeft
CharRemovedFromLeft / FromRight: non-mutating singular form. Accepts a one-arg call (param ignored) for narrative-friendly spellings like CharRemovedFromLeft("*"). CharRemovedFromLeft(c): drop ONE leading char ONLY if it equals c (no-op when c is absent). Non-mutating. The XT form strips the whole run.QCSXTZZZIBWU
CharRemovedFromRight
A copy with the trailing run of the given char dropped.QCSXTZZZIBWU
Consecutive (adjacent) substrings, per the original monolith: for each length i in 1..floor(n/2), the string is tiled from each of the i phase offsets into i-char windows (phase-major order). Across all phases that yields every window of length i, so the count per length is n-i+1 and the total is Sum(n-i+1).
1 examples runcomposed example
o1 = new stzString("banana split")
? o1.NumberOfConsecutiveSubStrings()
#--> 57composed from the signature, run for this page no extensionNumberOfConsecutiveSubStringsOf
How many CONSECUTIVE repetitions of pcSub the string holds.
composed example
o1 = new stzString("banana split")
? o1.NumberOfConsecutiveSubStringsOf("an")
#--> 1composed from the signature, run for this page no extensionENGINE-BACKED (StzEngineStringConsecutiveSubStrings): all window tilings 1..floor(len/2). Retires the O(len^2) Haro double-loop.
2 examples runoA = new stzString("a")
s = new stzString( oA.Repeated(1000) )
# ConsecutiveSubStrings count is 375,250
? len(s.ConsecutiveSubStrings())
# FindDupSecutiveChars is 999 (positions 2..1000)
? len(s.FindDupSecutiveChars())
#--> 375250
#--> 999library testQCSXTZZZIBWUFindConsecutiveSubStrings
The original Find form returns the UNIQUE per-length indices, which reduce to [1..n] (the length-1 row alone spans them all).
composed example
o1 = new stzString("banana split")
? @@( o1.FindConsecutiveSubStrings() )
#--> [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 ]composed from the signature, run for this page QCSXTZZZIBWUSame as ShortenedXT: ShortenedXT(nLeft, nRight, pcEllipsis): keep nLeft chars from the start and nRight from the end, with pcEllipsis between. A 0 left count mirrors the right (the symmetric default).
1 examples run# ShortenedUsing(' {...} ') keeps 3 each side
? Q("1234567890987654321").ShortenedUsing(" {...} ")
# ShortenedNUsing(5, ' {...} ') keeps 5 each side
? Q("1234567890987654321").ShortenedNUsing(5, " {...} ")
#--> 123 {...} 321
#--> 12345 {...} 54321library testno extensionBoundsRemoved(): drop the auto-detected leading + trailing non-letter bounds.
1 examples runcomposed example
o1 = new stzString("banana split")
? o1.BoundsRemoved()
#--> anana splicomposed from the signature, run for this page QCSXTZZZIBWUNumberOfConsecutiveSubStringsOfNChars
How many consecutive n-char chunks the string splits into.
composed example
o1 = new stzString("banana split")
? o1.NumberOfConsecutiveSubStringsOfNChars(2)
#--> 11composed from the signature, run for this page no extensionUnspacify(): trim, then collapse each run of 2+ spaces to one (the original monolith: Trim + remove dup-consecutive spaces).
1 examples runo1 = new stzString(" so ftan za ")
o1.Unspacify()
# edges trimmed, the 3-space run collapsed
? o1.Content()
#--> so ftan zalibrary testQCSXTZZZIBWUA copy with the spaces removed; the original is unchanged.
3 examples run# "r in g " -> "r in g"
? Q("r in g ").Unspacified()
# " r in g " -> "r in g"
? Q(" r in g ").Unspacified()
#--> r in g
#--> r in glibrary testno extensionThe position of the nth occurrence of pcSub after the given position (0 when there is none).
1 examples runcomposed example
o1 = new stzString("banana split")
? o1.FindNthNext(2, "an", 5)
#--> 0composed from the signature, run for this page no extensionFindNthPrevious / FindNthNext on stzString.
3 examples runo1 = new stzString("12♥4♥67")
# previous from 5
? o1.FindPrevious("♥", :StartingAt = 5)
# 2nd previous from 6
? o1.FindNthPrevious(2, "♥", :StartingAt = 6)
#--> 3
#--> 3library testno extensionFirstZ
FirstZ(sub) -- the Z grouping [sub, position] of the first occurrence (0-arg keeps the first-char section form).
composed example
o1 = new stzString("banana split")
? @@( o1.FirstZ("an") )
#--> [ "an", 2 ]composed from the signature, run for this page QCSXTZZZIBWULastZ
The last char along with its position.
composed example
o1 = new stzString("banana split")
? @@( o1.LastZ() )
#--> [ 12, 12 ]composed from the signature, run for this page no extensionVizFind / VizFindCSXT / VizFindXT -- visualization (returns a rendered string showing match positions). Provisional: just return the content with matched chars highlighted via ASCII.
3 examples run# four carets on the rail
? StzStringQ("ABTCADNBBABEFACCC").VizFind("A")
#--> ABTCADNBBABEFACCC
#--> ^---^----^---^---library testQCSXTZZZIBWUManyConsecutiveSubStringsOfNChars
SectionsOfSameItems already defined as method; expose as alias in case test calls a slightly different spelling. ConsecutiveSubStringsOfNChars(n) -- value form: the substrings (not just count) that appear consecutively. ConsecutiveSubStringsOfNChars(n): the n-char windows obtained by tiling the string from each of the n phase offsets (phase-major), per the original monolith. ENGINE-BACKED (StzEngineStringConsecutiveSubStringsOfN): phase-major window tiling of n codepoints. Retires the O(len) Haro double-loop.
composed example
o1 = new stzString("banana split")
? @@( o1.ConsecutiveSubStringsOfNChars(2) )
#--> [ "ba", "na", "na", " s", "pl", "it", "an", "an", "a ", "sp", "li" ]composed from the signature, run for this page QCSXTZZZIBWUFindNthAsSection
FindNthAsSection(n, pcSub): [start, end] of the n-th occurrence.
composed example
o1 = new stzString("banana split")
? @@( o1.FindNthAsSection(2, "an") )
#--> [ 4, 5 ]composed from the signature, run for this page no extensionNthStz
NthStz(n[, pcSub, :StartingAt = N]): 1-arg : the n-th char wrapped in stzChar 3-arg : start position of n-th occurrence of pcSub, optionally from a given position
composed example
o1 = new stzString("banana split")
? @@( o1.NthStz(2, "an", 2) )
#--> [ "an", 4 ]composed from the signature, run for this page no extensionFindNthSZZ
The nth occurrence of the substring from the given start position, as [start, end] section(s).
composed example
o1 = new stzString("banana split")
? @@( o1.FindNthSZZ(2, "an", 2) )
#--> [ "an", [ 4, 5 ] ]composed from the signature, run for this page no extensionFirstSTDZ
FirstSTDZ(pcSub, nStartAt, pDir): pos only (no section). The STDZ/STDZZ forms carry the [sub, pos] / [sub, span] grouping.
composed example
o1 = new stzString("banana split")
? @@( o1.FirstSTDZ("an", 2, :Forward) )
#--> [ "an", 2 ]composed from the signature, run for this page QCSXTZZZIBWUCharsInSection
CharsInSection(n1, n2): the chars in the [n1, n2] section as a list.
composed example
o1 = new stzString("banana split")
? @@( o1.CharsInSection(2, 5) )
#--> [ "a", "n", "a", "n" ]composed from the signature, run for this page no extensionReplaceInSections
ReplaceInSections(aSections, pcOld, pcNew): apply Replace only inside the given sections. Walks sections descending so positions stay valid.QCSXTZZZIBWU
ReplaceCharsWXT(pcCondition, pcNewChar): replace every char matching the predicate with pcNewChar. Engine-backed walk.
2 examples runcomposed example
o1 = new stzString("banana split")
o1.ReplaceCharsW("@char = 'a'", "AN")
? o1.Content()
#--> bANnANnAN splitcomposed from the signature, run for this page QCSXTZZZIBWUReplaceEachLeadingChar(pcNewChar): replace every leading run char with pcNewChar.
2 examples runcomposed example
o1 = new stzString("banana split")
o1.ReplaceEachLeadingChar("AN")
? o1.Content()
#--> ANanana splitcomposed from the signature, run for this page QCSXTZZZIBWUReplace EACH char of the trailing run with the given char (mutating).
2 examples runcomposed example
o1 = new stzString("banana split")
o1.ReplaceEachTrailingChar("AN")
? o1.Content()
#--> banana spliANcomposed from the signature, run for this page QCSXTZZZIBWUSame as ReplaceEachLeadingChar: ReplaceEachLeadingChar(pcNewChar): replace every leading run char with pcNewChar.
1 examples runcomposed example
o1 = new stzString("banana split")
o1.ReplaceEachLeadingAndTrailingChar("AN")
? o1.Content()
#--> ANanana spliANcomposed from the signature, run for this page QCSXTZZZIBWUReplaceSubStringsWithMarquers
ReplaceSubStringsWithMarquers: turn the listed substrings INTO their ordinal marquers (#1, #2, ...) -- the inverse of ReplaceMarquers.
composed example
o1 = new stzString("banana split")
o1.ReplaceSubStringsWithMarquers([ "an", "a" ])
? o1.Content()
#--> b#1#1#2 splitcomposed from the signature, run for this page QCSXTZZZIBWUReplaceSubStringsWithMarkers
Same as ReplaceSubStringsWithMarquers: ReplaceSubStringsWithMarquers: turn the listed substrings INTO their ordinal marquers (#1, #2, ...) -- the inverse of ReplaceMarquers.
composed example
o1 = new stzString("banana split")
o1.ReplaceSubStringsWithMarkers([ "an", "a" ])
? o1.Content()
#--> b#1#1#2 splitcomposed from the signature, run for this page no extensionUnicodeDataAsStringEmpty
UnicodeDataAsString() and MarquersPositions(): missing globals called inside the test scripts. We make them top-level stubs so the R3 misses resolve. The full UnicodeDataAsString returns the entire Unicode database as a string (engine call); for now we return "" so the test load completes -- it's only used by perf-comparison narratives.no extension
LastSTDZ
LastSTDZ / LastSTDZZ: positional / sectional last-occurrence directional search from a starting position.
composed example
o1 = new stzString("banana split")
? @@( o1.LastSTDZ("an", 2, :Forward) )
#--> [ "an", 4 ]composed from the signature, run for this page QCSXTZZZIBWUFindOccurrences
FindOccurrences(pcSub | anN, :Of = pcSub): all positions, or select positions of nth-occurrences from a list.also written: FindAllOccurrences · FindTheseOccurrences · FindTheseOccurrencesAsSQCSXTZZZIBWUSTD
FindTheseOccurrencesSD
FindTheseOccurrencesSD(anN, :Of=pcSub, :StartingAt=N, pDir): typo-tolerant alias accepting optional :StartingAt.QCSXTZZZIBWU
NthStzS
NthStzS(n, pcSub[, :StartingAt = N]): start position of the n-th occurrence of pcSub, optionally starting from a given position. (Spelled NthStzS to avoid case-insensitive collision with NthStz.)
composed example
o1 = new stzString("banana split")
? o1.NthStzS(2, "an", 2)
#--> 4composed from the signature, run for this page QCSXTZZZIBWUNext3CharsAsString
The three chars after the given position, as a string.
composed example
o1 = new stzString("banana split")
? o1.Next3CharsAsString(3)
#--> anacomposed from the signature, run for this page no extensionFirstStz
FirstStz / LastStz: the [sub, position] grouping of the first / last occurrence at or after :StartingAt (the S = starting-at family is forward-looking).
composed example
o1 = new stzString("banana split")
? @@( o1.FirstStz("an", 2) )
#--> [ "an", 2 ]composed from the signature, run for this page no extensionLastStz
The last occurrence: the substring paired with its position, from the given start position (an empty list when there is no match).
composed example
o1 = new stzString("banana split")
? @@( o1.LastStz("an", 2) )
#--> [ "an", 4 ]composed from the signature, run for this page no extensionCharTrimmedFromLeft
Same as CharRemovedFromLeftXT: CharRemovedFromLeft / FromRight: non-mutating singular form. Accepts a one-arg call (param ignored) for narrative-friendly spellings like CharRemovedFromLeft("*"). CharRemovedFromLeft(c): drop ONE leading char ONLY if it equals c (no-op when c is absent). Non-mutating. The XT form strips the whole run. (extended form: takes an options list)no extension
CharTrimmedFromRight
Same as CharRemovedFromRightXT: A copy with the trailing run of pcChar dropped; the original is unchanged.no extension
FindLastSZZ
The SZZ forms group [sub, [start, end]] (per the original archive: FindLastSZZ("♥♥♥", :StartingAt = 6) --> [ "♥♥♥", [13, 15] ]).
composed example
o1 = new stzString("banana split")
? @@( o1.FindLastSZZ("an", 2) )
#--> [ "an", [ 4, 5 ] ]composed from the signature, run for this page no extensionFindFirstSZZ
The first occurrence of the substring from the given start position, as [start, end] section(s).
composed example
o1 = new stzString("banana split")
? @@( o1.FindFirstSZZ("an", 2) )
#--> [ "an", [ 2, 3 ] ]composed from the signature, run for this page no extensionFindTheseOccurrencesAsSections
The [start, end] sections of the chosen occurrence numbers (:Of = sub).QCSXTZZZIBWUSTD
TheseSubstringsZ
TheseSubstringsZ(pacSubStr): start positions of any listed substring's first occurrence. TheseSubstringsZ([subs]): each substring grouped with ALL its positions -- [ [sub, [positions]], ... ].
composed example
o1 = new stzString("banana split")
? @@( o1.TheseSubstringsZ([ "an", "a" ]) )
#--> [ [ "an", [ 2, 4 ] ], [ "a", [ 2, 4, 6 ] ] ]composed from the signature, run for this page QCSXTZZZIBWUSplitAroundCS_named
(FindAntiSectionsZZ already exists earlier; the FindExceptZZ helper above covers the gap-sections semantic.) SplitAroundCS(pcSub, pCaseSensitive): like SplitAround but tolerant of named-param :CS = bCase.no extension
SubStringXT(p1, p2): polymorphic substring DSL. SubStringXT(n, :NCharsFrom = m) -- m chars from pos n SubStringXT(pcSub, :NCharsFrom = m) -- m chars after pcSub SubStringXT(:NCharsBefore = m, pcSub) -- m chars before pcSub
1 examples run# the named-param shape is recognised
? Q(:IsBoundedBy = ".").IsIsBoundedByNamedParam()
# the direct check
? Q(".♥.").SubStringIsBoundedBy("♥", ".")
# the SubStringXT spelling
? Q(".♥.").SubStringXT("♥", :IsBoundedBy = ".")
#--> 1
#--> 1
#--> 1library testno extensionIsIsBoundedByNamedParam
IsIsBoundedByNamedParam: predicate on the content list for the :IsBoundedBy named-param shape. Returns TRUE iff content is a 2-elem list [:IsBoundedBy, ...].no extension
CommonItems
CommonItems(:With = pcOther): same idea as CommonSubStrings but at the CHAR level (intersection of char sets).no extension
FindConsecutiveSubStringsOfNChars(n): positions of each back-to-back n-char identical pair. RemoveNthChar(n): remove the char at codepoint position n. Accepts :First / :Last / :Middle symbolic positions.
2 examples runo1 = new stzString("125.450")
o1.RemoveNthChar(7)
# the 7th char is gone
? o1.Content()
#--> 125.45library testQCSXTZZZIBWUAntiFind
Antifind on stzString: synonyms of AntiFindAsSections / AntiFind. AntiFind(pcSub) here returns the positions of every char that is NOT inside pcSub's occurrences -- the complement walk.
composed example
o1 = new stzString("banana split")
? @@( o1.AntiFind("an") )
#--> [ 1, 6, 7, 8, 9, 10, 11, 12 ]composed from the signature, run for this page QCSXTZZZIBWUSplitAroundCSNamed
SplitAroundCS alias delegating to existing.
composed example
o1 = new stzString("banana split")
? @@( o1.SplitAroundCSNamed("an", 2) )
#--> [ "b", "", "a split" ]composed from the signature, run for this page no extension>= n occurrences (canonical + misspelled alias)
1 examples runcomposed example
o1 = new stzString("banana split")
? @@( o1.SubStringsOccuringNTimes(2) )
#--> [ "a", "an", "n", "na" ]composed from the signature, run for this page no extension= n occurrences The substrings occurring EXACTLY n times.
1 examples runcomposed example
o1 = new stzString("banana split")
? @@( o1.SubStringsOccurringOnlyNTimes(2) )
#--> [ "an", "n", "na" ]composed from the signature, run for this page no extensionYieldCharsW(pcYielder, pNamedWhere): transform every char through the yielder expression via the engine char-map (StzEngineStringMapChars, expr.zig -- no eval). Optional :Where = predicate restricts to the matching chars first (engine FindCharsW). @char binding. Replaces the retired raw-eval YieldCharsWXT.
1 examples run# FindCharsW reports the letter positions
? @@( Q("..ONE...TWO..").FindCharsW('isLetter(@char)') )
# YieldCharsW with :Where collects the letters
? @@( Q("..ONE...TWO..").YieldCharsW('@char', :Where = 'isLetter(@char)') )
#--> [ 3, 4, 5, 9, 10, 11 ]
#--> [ "O", "N", "E", "T", "W", "O" ]library testno extensionSplitToPartsOfNChars
SplitToPartsOfNChars(n): split into pieces of EXACTLY n chars -- a shorter trailing remainder is DROPPED (the XT form keeps it).
also written: SplitToPartsOfExactlyNCharscomposed example
o1 = new stzString("banana split")
? @@( o1.SplitToPartsOfNChars(2) )
#--> [ "ba", "na", "na", " s", "pl", "it" ]composed from the signature, run for this page QCSXTZZZIBWUNextNChars
PreviousNChars / NextNChars: the n chars before / after the first occurrence of a delimiter substring.
also written: NextNItemscomposed example
o1 = new stzString("banana split")
? o1.NextNChars("an", 2)
#--> ancomposed from the signature, run for this page no extensionPreviousNChars
The n chars before the given anchor (position or substring).
also written: PreviousNItemscomposed example
o1 = new stzString("banana split")
? o1.PreviousNChars("an", 2)
#--> bcomposed from the signature, run for this page no extensionFindNumbers
FindNumbers(): start positions of every (sign- and decimal-aware) number -- derived from the same sections Numbers() uses.QCSXTZZZIBWU
UniqueNumbers
UniqueNumbers(): the distinct numbers in the content. Uses Numbers() (NOT ExtractNumbers, which now mutates by removing them).no extension
SubStringsOccurringExactlyNTimes
The substrings occurring EXACTLY n times.
composed example
o1 = new stzString("banana split")
? @@( o1.SubStringsOccurringExactlyNTimes(2) )
#--> [ "an", "n", "na" ]composed from the signature, run for this page no extensionSubStringsOccurringNTimes
The substrings occurring AT LEAST n times.
composed example
o1 = new stzString("banana split")
? @@( o1.SubStringsOccurringNTimes(2) )
#--> [ "a", "an", "n", "na" ]composed from the signature, run for this page no extensionNumbrifyQ
NumbrifyQ / NumbrifiedQ: alias for ToNumber wrap.also written: NumbrifiedQno extension
TRUE if the string starts with the given number (prefix equality).
1 examples runcomposed example
o1 = new stzString("banana split")
? o1.StartsWithThisNumber("an")
#--> 0composed from the signature, run for this page no extensionSplitToPartsOfNCharsXTOpt
Split into n-char parts with options (keep-remainder form).
composed example
o1 = new stzString("banana split")
? @@( o1.SplitToPartsOfNCharsXTOpt(2, 5) )
#--> [ "ba", "na", "na", " s", "pl", "it" ]composed from the signature, run for this page no extensionNumbersAndTheirPositions
Same as NumbersZ: The numbers embedded in the string, each with its position.no extension
NumbersAndTheirSections
Same as NumbersZZ: The numbers embedded in the string, each with its [start, end] section.no extension
NthNumberComingAfter
NthNumberComingAfter(n, pcAnchor): the n-th number after pcAnchor.
composed example
o1 = new stzString("banana split")
? o1.NthNumberComingAfter(2, "an")
#--> 0composed from the signature, run for this page no extensionIsNotLetter() -- TRUE if This is NOT a single letter char. (IsLetter already exists above; just add the negation.)
1 examples run# * is not a letter, computationally
? NOT Q("*").IsLetter()
# ... and linguistically
? Q("*").IsNotLetter()
#--> 1
#--> 1library testno extensionIsAtCharsNamedParam
IsAtCharsNamedParam(): TRUE iff content is [:AtChars, value]. We're a string -> always FALSE.no extension
SplitAroundPositions(anPos): split at each position; the delimiter char at each position becomes its own piece. SplitAroundPositions(anPos): the pieces between the positions (the chars AT the positions are dropped).
1 examples run# the pieces between the positions remain
? @@( Q("---4---8---").SplitAroundPositions([ 4, 8 ]) )
#--> [ "---", "---", "---" ]library testno extensionIsPluralOfThisStzType(pcType): TRUE if content is the plural form of pcType (i.e. equal to pcType + "s").
1 examples run# stzchars is a plural of a stz type
? Q("stzchars").IsPluralOfAStzType()
# ... specifically of stzchar
? Q("stzchars").IsPluralOfThisStzType("stzchar")
#--> 1
#--> 1library testno extensionInfereMethod(:From = :stzClass): infer the predicate method the given class offers for THIS string -- "is" + string, else "is" + string-minus-final-s (per the original monolith). E.g. Q("punctuation").InfereMethod(:From = :stzChar) -> "ispunctuation".
1 examples run# punctuation infers its checker
? Q("punctuation").InfereMethod(:From = :stzChar)
# the plural falls back to the singular
? Q("punctuations").InfereMethod(:From = :stzChar)
#--> ispunctuation
#--> ispunctuationlibrary testno extensionDuplicatedCharsRemoved
A copy with the duplicated chars removed; the original is unchanged.
composed example
o1 = new stzString("banana split")
? o1.DuplicatedCharsRemoved()
#--> ban splitcomposed from the signature, run for this page no extensionA stzString IS a string (stzChar answers TRUE via its own def).
1 examples run# a stzString is a string
? StzStringQ("s").IsString()
# a stzChar is a string too
? StzCharQ("s").IsString()
#--> 1
#--> 1library test · written IsAString() in the library today: the host language already holds IsString(), and Haro removes the detourno extensionIsAFunction: is the content the name of a DEFINED function (per the original monolith: functions() lookup)? The call-looking check is IsAlmostAFunctionCall.
1 examples runalso written: IsFunc · IsAFunctionName# stzLen is a function
? Q("stzLen").IsFunction()
# stzChar is a class
? Q("stzChar").IsClass()
#--> 1
#--> 1library test · written IsAClass() in the library today: the host language already holds IsClass(), and Haro removes the detour; written IsAFunction() in the library today: the host language already holds IsFunction(), and Haro removes the detourno extensionIsAnInteger
TRUE if the string is an integer literal (trimmed).
also written: IsIntegercomposed example
o1 = new stzString("banana split")
? o1.IsAnInteger()
#--> 0composed from the signature, run for this page no extensionFindSpaces
FindSpaces() / FindEmptyStrings(): positions of every " ".
also written: FindEmptyStringscomposed example
o1 = new stzString("banana split")
? @@( o1.FindSpaces() )
#--> [ 7 ]composed from the signature, run for this page no extensionCheck([pcExpr]) -- evaluate pcExpr per char (@char in scope) and return TRUE if it holds for every char. 0-arg form is the existence-check stub used by re-include narratives.
2 examples run? Q("(,,)").Check(:That = 'StzCharQ(@Char).IsPunctuation()')
#--> 1library testno extensionSubStringsOccurringLessThanNTimes
The substrings occurring fewer than n times.also written: SubStringsOccurringNoMoreThanNTimesno extension
Removed
A copy of the string with every occurrence of pcWhat removed; the original is unchanged.
composed example
o1 = new stzString("banana split")
? o1.Removed("an")
#--> ba splitcomposed from the signature, run for this page no extensionIsBoundOfXT
IsBoundOfXT(:Open=, :Close=) -- TRUE iff the content equals one of the bounds (i.e. it IS the opening or closing string).
composed example
o1 = new stzString("banana split")
? o1.IsBoundOfXT(2, 5)
#--> 0composed from the signature, run for this page no extensionIsAClass(): TRUE if content is a Haro class name (lookup via Haro's classes() introspection).
1 examples run# stzLen is a function
? Q("stzLen").IsFunction()
# stzChar is a class
? Q("stzChar").IsClass()
#--> 1
#--> 1library test · written IsAClass() in the library today: the host language already holds IsClass(), and Haro removes the detour; written IsAFunction() in the library today: the host language already holds IsFunction(), and Haro removes the detourno extensionCombinations
Combinations(n): every n-char combination from the content.no extension
IsNotAString
IsNotAString(): TRUE iff content is NOT a string. We're a stzString -- always FALSE.
composed example
o1 = new stzString("banana split")
? o1.IsNotAString()
#--> 0composed from the signature, run for this page no extensionAreBoundsOfXT
AreBoundsOfXT(:Open=, :Close=): TRUE iff THIS contains both bounds; the IsBoundOfXT predicate flipped to "we contain something bounded by these".
composed example
o1 = new stzString("banana split")
? o1.AreBoundsOfXT(2, 5)
#--> 0composed from the signature, run for this page no extensionRandomPositionAfter
RandomPositionAfter(nFrom): a random codepoint position strictly after nFrom (inclusive of the last position).no extension
ContainsMoreThenN(n, pcSub) or (pcSub, n): TRUE iff content contains pcSub strictly more than n times.
1 examples runcomposed example
o1 = new stzString("banana split")
? o1.ContainsMoreThenN("an", 2)
#--> 0composed from the signature, run for this page no extensionContainsMoreThanN
TRUE if pcSub occurs MORE than n times.
composed example
o1 = new stzString("banana split")
? o1.ContainsMoreThanN("an", 2)
#--> 0composed from the signature, run for this page no extensionContainsAtLeastN
TRUE if pcSub occurs at least n times.
composed example
o1 = new stzString("banana split")
? o1.ContainsAtLeastN("an", 2)
#--> 1composed from the signature, run for this page no extensionContainsExactlyN
TRUE if pcSub occurs exactly n times.
composed example
o1 = new stzString("banana split")
? o1.ContainsExactlyN("an", 2)
#--> 1composed from the signature, run for this page no extensionIsMarquer
IsMarquer / IsMarker: TRUE iff content is a "#N" marker token.
also written: IsMarkercomposed example
o1 = new stzString("banana split")
? o1.IsMarquer()
#--> 0composed from the signature, run for this page no extensionNumberOfEmptyLines
NumberOfEmptyLines(): count blank lines (after trim).
composed example
o1 = new stzString("banana split")
? o1.NumberOfEmptyLines()
#--> 0composed from the signature, run for this page no extensionNumberOfNonEmptyLines
How many non-empty lines the string holds.
composed example
o1 = new stzString("banana split")
? o1.NumberOfNonEmptyLines()
#--> 1composed from the signature, run for this page no extensionBoundsUpToNChars
The string's bounds, capped to n chars each.no extension
Move(n1, n2): move char from position n1 to position n2. Accepts named-param form Move(:CharFromPosition = N, :To = M).
1 examples runcomposed example
o1 = new stzString("banana split")
o1.Move(2, 5)
? o1.Content()
#--> bnaana splitcomposed from the signature, run for this page QCSXTZZZIBWUSwap(n1, n2): swap chars at positions n1 and n2. Also accepts Swap(:Positions = n1, :And = n2) and Swap(pcA, :And = pcB) to swap two substrings.
2 examples runo1 = new stzString("TWO, ONE, THREE!")
o1.Swap("TWO", :And = "ONE")
# the words traded places
? o1.Content()
#--> ONE, TWO, THREE!library testQCSXTZZZIBWUNthToLast(n): the n-th-to-last char ("1st to last" = last). NthToLast(n): the char at position len - n (the original: CharAtPosition(NumberOfChars() - n)).
1 examples run# SOFTANZA's 3rd-to-last is A
? Q("SOFTANZA").NthToLast(3)
#--> Alibrary testno extensionUniqueSubStringsBoundedBy
Same as SubStringsBoundedByU: SubStringsBoundedByU: the UNIQUE bounded substrings ("U" = unique, not case-insensitive -- the settled Z/U convention).no extension
Positions
Positions(pcSub): all positions of pcSub (alias of AllPositionsOf; accepts the :Of / :OfSubString named spelling).
also written: FindPositionscomposed example
o1 = new stzString("banana split")
? @@( o1.Positions("an") )
#--> [ 2, 4 ]composed from the signature, run for this page no extensionFindNthBoundedBy
FindNthBoundedBy(n, pacBounds, pcSub): position of the n-th occurrence of pcSub inside any bounded section.
composed example
o1 = new stzString("banana split")
? o1.FindNthBoundedBy(2, [ "an", "a" ], "an")
#--> 0composed from the signature, run for this page QCSXTZZZIBWURanges
Ranges([aRanges]): contiguous-character ranges, or section-text extraction when given a list of [start, count] ranges. Test 543: o1.Ranges([[1,2],[8,3],...]) -> sliced sections.
composed example
o1 = new stzString("banana split")
? @@( o1.Ranges(3) )
#--> [ [ "b", "b" ], [ "a", "a" ], [ "n", "n" ], [ "a", "a" ], [ "n", "n" ], [ "a", "a" ], [ " ", " " ], [ "s", "s" ], [ "p", "p" ], [ "l", "l" ], [ "i", "i" ], [ "t", "t" ] ]composed from the signature, run for this page no extensionRemoveBoundedSubString(pacBounds): remove the entire bounded section (including bounds) of the FIRST match. RemoveBoundedSubString(pcSub): remove the BOUNDED occurrences of pcSub (their content only -- the bounds stay); a 2-list keeps the legacy remove-first-region-with-bounds behavior.
1 examples runo1 = new stzString("bla word bla <<word>> bla bla <<word>> bla <<word>> word")
o1.RemoveBoundedSubString("word")
# only the bounded contents vanish
? o1.Content()
#--> bla word bla <<>> bla bla <<>> bla <<>> wordlibrary testQCSXTZZZIBWURemoveAnySubStringBoundedBy: remove every bounded region's CONTENT (the bounds stay); the IB form removes bounds too.
2 examples runo1 = new stzString("bla bla <<word>> bla bla <<noword>> bla <<word>>")
o1.RemoveAnySubStringBoundedBy([ "<<", ">>" ])
# the shells remain
? o1.Content()
#--> bla bla <<>> bla bla <<>> bla <<>>library testQCSXTZZZIBWUSubStringBounds
SubStringBounds(pcSub): the FLAT bound-run SUBSTRINGS of every bounded occurrence (left then right, in order) -- ["<<", ">>", "<<", ">>", ...].
composed example
o1 = new stzString("banana split")
? @@( o1.SubStringBounds("an") )
#--> [ "b", "a", "n", "a" ]composed from the signature, run for this page QCSXTZZZIBWUFindTheseSubStringBounds
FindTheseSubStringBounds(pcSub|pacSubStr [, pacBounds]): - 1-arg list: per substring, the [before, after] single-char bounds - 2-arg (string, list): the bounds of pcSub when found inside any of the explicit pacBounds [open, close] pair FindTheseSubStringBounds(pcSub, [open, close]): the FLAT start positions of the open/close tokens IMMEDIATELY around each occurrence of pcSub (only exactly-bounded occurrences count).QCSXTZZZIBWU
IsRightToLeft
NRightCharsAsSubString(n) / NLeftCharsAsSubString(n). For a right-to-left string the VISUAL right is the string START (per the original NRightCharsAsSubString: IsRightToLeft -> the leading codepoints).
composed example
o1 = new stzString("banana split")
? o1.IsRightToLeft()
#--> 0composed from the signature, run for this page no extensionThe n rightmost chars, direction-aware, as a string.
1 examples runo1 = new stzString("هذه الكلمات الّتي سوف تبقى")
# the right 4 chars open the text
? o1.NRightCharsAsSubstring(4)
o1.RemoveFromRight("هذه ")
# removing from the right trims the start
? o1.Content()
#--> هذه
#--> الكلمات الّتي سوف تبقىlibrary testno extensionNLeftCharsAsSubString
The n leftmost chars, direction-aware, as a string.
composed example
o1 = new stzString("banana split")
? o1.NLeftCharsAsSubString(2)
#--> bacomposed from the signature, run for this page no extensionRemoveNthOccurrence(n, pcSub): remove the n-th occurrence of pcSub. RemoveNthOccurrence(n, pcSub): remove the n-th occurrence of pcSub; n may be the symbols :First / :Last.
2 examples runo1 = new stzString("**A1****A2***A3")
o1.RemoveNthOccurrence(:Last, "A")
# the third A is gone
? o1.Content()
#--> **A1****A2***3library testQCSXTZZZIBWUAddBounds([pcOpen, pcClose]): wrap content with bounds. 1-arg list form accepted: AddBounds(["<<", ">>"]).
1 examples runo1 = new stzString("word")
o1.AddBounds(["<<",">>"])
# bounded
? o1.Content()
#--> <<word>>library testQCSXTZZZIBWUBoundWith
Same as AddBounds: AddBounds([pcOpen, pcClose]): wrap content with bounds. 1-arg list form accepted: AddBounds(["<<", ">>"]).QCSXTZZZIBWU
Same as BeginsWithOneOfTheseCS: (FirstBoundsOf / LastBoundsOf live next to BoundsOf above.) BeginsWithOneOfTheseCS(pacSubStr, pCaseSensitive): TRUE if the content starts with any of the listed substrings.
1 examples runalso written: StartsWithOneOfThesecomposed example
o1 = new stzString("banana split")
? o1.BeginsWithOneOfThese([ "an", "a" ])
#--> 0composed from the signature, run for this page QCSXTZZZIBWUStartsWithEither
Same as StartsWithEitherCS: The second argument arrives as the pair [ :Or, "..." ]; a bare string is accepted too.also written: BeginsWithEitherQCSXTZZZIBWU
EndsWithOneOfThese
Same as EndsWithOneOfTheseCS: TRUE if the string ends with ANY of the given suffixes.
composed example
o1 = new stzString("banana split")
? o1.EndsWithOneOfThese([ "an", "a" ])
#--> 0composed from the signature, run for this page QCSXTZZZIBWUHasCentralChar(): TRUE iff content length is odd.
1 examples runcomposed example
o1 = new stzString("banana split")
? o1.HasCentralChar()
#--> 0composed from the signature, run for this page no extensionThe middle char of the string (odd lengths).
1 examples runno extensionIsMultipleOf(pcUnit): TRUE iff content is pcUnit repeated.
1 examples runcomposed example
o1 = new stzString("banana split")
? o1.IsMultipleOf("an")
#--> 0composed from the signature, run for this page QCSXTZZZIBWUMarquer
Marquer / Marker: the FIRST marker number. Marquer(): the marquer SYMBOL itself.
also written: Markercomposed example
o1 = new stzString("banana split")
? o1.Marquer()
#--> #composed from the signature, run for this page no extensionContainsMarquers
TRUE if the string contains marquers.
also written: ContainsMarkerscomposed example
o1 = new stzString("banana split")
? o1.ContainsMarquers()
#--> 0composed from the signature, run for this page no extensionIsIncludedIn
TRUE if the string occurs inside the given one.
also written: IncludedIncomposed example
o1 = new stzString("banana split")
? o1.IsIncludedIn("an")
#--> 1composed from the signature, run for this page no extensionReplaceSubStringAtPositions
ReplaceSubStringAtPositions(anPos, pcOld, pcNew). pcNew accepts :By = "..." named-param form.
composed example
o1 = new stzString("banana split")
o1.ReplaceSubStringAtPositions([ 1, 2 ], "an", "AN")
? o1.Content()
#--> bANana splitcomposed from the signature, run for this page QCSXTZZZIBWUSort the marquers in descending order (mutating).
1 examples runno extensionSortMarkersInDescending
Same as SortMarquersInDescending: Sort the marquers in descending order (mutating).no extension
Sort the marquers in ascending order (mutating).
1 examples runno extensionSortMarkersInAscending
Same as SortMarquersInAscending: Sort the marquers in ascending order (mutating).no extension
MarquersAndPositions
Same as MarquersZ: MarquersZ: each marquer grouped with its start position.no extension
NFirstOccurrences
NFirstOccurrences(n, :Of = pcSub): the first n positions of pcSub.QCSXTZZZIBWUST
LastNOccurrences
The positions of the LAST n occurrences.QCSXTZZZIBWUST
NLastOccurrencesST
NLastOccurrencesST: the stzString spelling of the abstract stzObject form (whose SectionQ pipeline can't take symbols).no extension
MarquersAndSections
Each marquer paired with its [start, end] section.also written: MarkersAndSectionsno extension
ReplaceOccurrencesByMany
ReplaceOccurrencesByMany: (pcSubStr, paReplacements) : alias of ReplaceByMany (anN, pcSubStr, :By = paReplacements) : replace n-th selected occurrences with each replacement in turnQCSXTZZZIBWU
MarkTheseSubStringsCS
MarkTheseSubStringsCS: wrap each occurrence in [|...|]. MarkTheseSubStringsCS: replace each listed substring with its ordinal marquer #1, #2, ... (aka ReplaceSubstringsWithMarquersCS).no extension
Remove every occurrence of the given char (mutating).
1 examples runcomposed example
o1 = new stzString("banana split")
o1.RemoveChar(2)
? o1.Content()
#--> bnana splitcomposed from the signature, run for this page QCSXTZZZIBWUA copy with the given char removed everywhere.
1 examples runcomposed example
o1 = new stzString("banana split")
? o1.CharRemoved(2)
#--> bnana splitcomposed from the signature, run for this page no extensionRemove the char at position n only if it equals pcChar (mutating).
1 examples runQCSXTZZZIBWUTRUE if the chars are in ascending order.
2 examples run# is ascending
? Q("01233445679").IsSortedInAscending()
# not descending
? Q("01233445679").IsSortedInDescending()
#--> 1
#--> 0library testno extensionTRUE if the chars are in descending order.
3 examples run# is ascending
? Q("01233445679").IsSortedInAscending()
# not descending
? Q("01233445679").IsSortedInDescending()
#--> 1
#--> 0library testno extensionRemoveManySections
Remove the chars of each given [start, end] section (mutating).QCSXTZZZIBWU
Replace the nth occurrence AFTER the given position (mutating).
1 examples runo1 = new stzString( "----@@--@@-------@@----@@---")
o1.ReplaceNextNthOccurrence(2, :Of = "@@", :StartingAt = 12, :With = "##")
# the 2nd @@ after 12 became ##
? o1.Content()
#--> ----@@--@@-------@@----##---
library testQCSXTZZZIBWUReplace the nth occurrence BEFORE the given position (mutating).
1 examples runo1 = new stzString( "----@@--@@-------@@----@@---")
o1.ReplacePreviousNthOccurrence(2, :Of = "@@", :StartingAt = 22, :With = "##")
# the 2nd @@ before 22 became ##
? o1.Content()
#--> ----@@--##-------@@----@@---
library testQCSXTZZZIBWUTRUE if the string is the lowercase form of the given one.
2 examples run# in itself
? Q("date").IsLowercase()
# ... and of DATE
? Q("date").IsLowercaseOf("DATE")
#--> 1
#--> 1library testQCSXTZZZIBWUTRUE if the string is the uppercase form of the given one.
1 examples runcomposed example
o1 = new stzString("banana split")
? o1.IsUppercaseOf("an")
#--> 0composed from the signature, run for this page no extensionUppercasedInLocale
UppercasedInLocale / LowercasedInLocale -- locale-neutral fallback.
composed example
o1 = new stzString("banana split")
? o1.UppercasedInLocale("an")
#--> BANANA SPLITcomposed from the signature, run for this page no extensionThe string lowercased for the given locale (plain lowercase fallback).
2 examples run# DER FLUSS lowers to der fluss
? Q("DER FLUSS").LowercasedInLocale("de-DE")
# the eszett round-trip stays FALSE (documented limitation)
? Q("der fluß").IsLowercaseOfXT("DER FLUSS", :InLocale = "de-DE")
#--> der fluss
#--> 0library testno extensionThe case of the single-char string (codepoint-aware).
1 examples runcomposed example
o1 = new stzString("banana split")
? o1.CharCase()
#--> mixedcomposed from the signature, run for this page no extensionCountInSections
How many occurrences of pcSub fall inside the given sections.
also written: NumberOfOccurrencesInSectionscomposed example
o1 = new stzString("banana split")
? o1.CountInSections("an", [ "an", "a" ])
#--> 0composed from the signature, run for this page no extensionSplits
Splits([pcSep]): split-on-separator words; 0-arg uses whitespace.
composed example
o1 = new stzString("banana split")
? @@( o1.Splits(" ") )
#--> [ "banana", "split" ]composed from the signature, run for this page QCSXTZZZIBWURemoveRanges
Remove the chars of each given [start, range] slice (mutating).QCSXTZZZIBWU
RemoveTheseSubStringBounds
RemoveTheseSubStringBounds(pcSub, pacBounds): strip the bounds surrounding every occurrence of pcSub inside the bounded regions.
composed example
o1 = new stzString("banana split")
o1.RemoveTheseSubStringBounds("an", [ "an", "a" ])
? o1.Content()
#--> ban splitcomposed from the signature, run for this page QCSXTZZZIBWUWalkForwardW
Walk forward collecting where the W condition holds (mirror of WalkBackwardW).
composed example
o1 = new stzString("banana split")
? @@( o1.WalkForwardW("@char = 'a'", 2) )
#--> [ 2, 4, 6 ]composed from the signature, run for this page no extensionFindWords
The position of each word of the string.
composed example
o1 = new stzString("banana split")
? @@( o1.FindWords() )
#--> [ 1, 8 ]composed from the signature, run for this page no extensionHasThisTrailingChar
Same as HasThisTrailingCharCS: HasThisTrailingChar(pcChar, pCS): TRUE iff content ends with a run of pcChar. (Distinct from HasTrailingChars() which is the 0-arg "has any trailing run" predicate above.)
composed example
o1 = new stzString("banana split")
? o1.HasThisTrailingChar("an")
#--> 0composed from the signature, run for this page QCSXTZZZIBWUHasThisLeadingChar
Same as HasThisLeadingCharCS: TRUE if the string starts with the given char.
composed example
o1 = new stzString("banana split")
? o1.HasThisLeadingChar("an")
#--> 0composed from the signature, run for this page QCSXTZZZIBWUFindTrailingChars
The positions of the trailing char run.
composed example
o1 = new stzString("banana split")
? @@( o1.FindTrailingChars() )
#--> [ 12 ]composed from the signature, run for this page QCSXTZZZIBWUFindLeadingChars
The positions of the leading char run.
composed example
o1 = new stzString("banana split")
? @@( o1.FindLeadingChars() )
#--> [ 1 ]composed from the signature, run for this page QCSXTZZZIBWUTRUE if the last char equals the given one.
1 examples runcomposed example
o1 = new stzString("banana split")
? o1.TrailingCharIs("an")
#--> 0composed from the signature, run for this page QCSXTZZZIBWULeadingCharIs
TRUE if the first char equals the given one.
composed example
o1 = new stzString("banana split")
? o1.LeadingCharIs("an")
#--> 0composed from the signature, run for this page QCSXTZZZIBWUPositionOfCentralChar: position of the center char (0 if even).
1 examples runcomposed example
o1 = new stzString("banana split")
? o1.PositionOfCentralChar()
#--> 0composed from the signature, run for this page no extensionIsNTimesMultipleOf(n, pcUnit): TRUE iff content is pcUnit repeated exactly n times.
1 examples runcomposed example
o1 = new stzString("banana split")
? o1.IsNTimesMultipleOf(2, "an")
#--> 0composed from the signature, run for this page no extensionMarkSubStringsCS
MarkSubStringsCS(pcSubStr, pCaseSensitive): mark every occurrence of pcSubStr with [|...|] (single-substring form).no extension
ReplaceMarquers
ReplaceMarquers(paReplacements): replace #1, #2, ... in order with paReplacements[1], [2], ... (engine-replace).no extension
ReplaceMarkers
Same as ReplaceMarquers: ReplaceMarquers(paReplacements): replace #1, #2, ... in order with paReplacements[1], [2], ... (engine-replace).no extension
FindInSections
the given sections (codepoint absolute positions).no extension
HasTrailingSubString
HasTrailingSubString(): TRUE iff content has any trailing word.
composed example
o1 = new stzString("banana split")
? o1.HasTrailingSubString()
#--> 0composed from the signature, run for this page no extensionHasLeadingSubString
TRUE if the string has a leading repeated-char run.
composed example
o1 = new stzString("banana split")
? o1.HasLeadingSubString()
#--> 0composed from the signature, run for this page no extensionHasTrailingSubStringOf
Same as EndsWithCS: Whether the string ends with the given suffix. (with the case-sensitivity dial)
composed example
o1 = new stzString("banana split")
? o1.HasTrailingSubStringOf("an")
#--> 0composed from the signature, run for this page no extensionHasLeadingSubStringOf
Same as StartsWithCS: Whether the string starts with the given prefix. (with the case-sensitivity dial)
composed example
o1 = new stzString("banana split")
? o1.HasLeadingSubStringOf("an")
#--> 0composed from the signature, run for this page no extensionTrailingSubStringZZOf
The [start, end] section of the trailing run of pcSub.no extension
MarquersPositions
Object wrappers around stzStringFunc global helpers so they resolve inside StzStringQ(){...} blocks. Inline rather than delegate to avoid same-name recursion.also written: FindMarkers · FindMarquers · MarkersPositionsno extension
Marker family: a "marquer" is a `#N` placeholder in content. These wrappers expose Find/First/Nth/Previous variants used by the StzStringQ block tests (609-628). Marquer accessors: the plain forms return the "#N" STRING, the Find* twins the position.
1 examples runalso written: FirstMarkerno extensionThe position of the first marquer.
1 examples runcomposed example
o1 = new stzString("banana split")
? o1.FindFirstMarquer()
#--> 0composed from the signature, run for this page no extensionThe nth marquer of the string.
1 examples runalso written: NthMarkero1 = new stzString("My name is #1, my age is #2, and my job is #3. Again: my name is #1!")
# the marquer
? o1.NthMarquer(2)
# its position
? o1.FindNthMarquer(2)
#--> #2
#--> 26library testno extensionThe position of the nth marquer.
1 examples runo1 = new stzString("My name is #1, my age is #2, and my job is #3. Again: my name is #1!")
# the marquer
? o1.NthMarquer(2)
# its position
? o1.FindNthMarquer(2)
#--> #2
#--> 26library testno extensionThe position of the last marquer.
1 examples runcomposed example
o1 = new stzString("banana split")
? o1.FindLastMarquer()
#--> 0composed from the signature, run for this page no extensionThe nth marquer after the given position.
1 examples runo1 = new stzString("My name is #1, my age is #2, and my job is #3. Again: my name is #1!")
# the marquer
? o1.NextNthMarquerST(2, :StartingAt = 14)
# its position
? o1.FindNextNthMarquerST(2, :StartingAt = 14)
#--> #3
#--> 44library testno extensionPreviousMarquers
The marquers before the given position.no extension
NextMarquers
The marquers after the given position.no extension
PreviousNthMarquer
The nth marquer before the given position.QCSXTZZZIBWU
FindNthPreviousMarquer
The nth occurrence of the substring from the given start position: the position(s).
also written: FindPreviousNthMarker · FindPreviousNthMarquercomposed example
o1 = new stzString("banana split")
? o1.FindNthPreviousMarquer(2, 2)
#--> 0composed from the signature, run for this page no extensionFindMarquersAsSections
The [start, end] section of every marquer.also written: FindMarkersAsSectionsno extension
UniqueMarquersAndTheirPositions
Same as MarquersUZ: The unique marquers, each with ALL its positions.no extension
UniqueMarquersAndTheirSections
Same as MarquersUZZ: The unique marquers, each with ALL its [start, end] sections.no extension
MarquerByPosition
The marquer covering the given position.also written: MarkerByPositionno extension
PreviousMarquerZ
PreviousMarquerZ: the nearest previous marquer with its position.also written: PreviousMarkerZno extension
MarquerByPositions
The marquer at each of the given positions.also written: MarkerByPositions · MarkersByPositions · MarquersByPositionsno extension
PreviousNthMarquerAndItsPosition
Same as PreviousNthMarquerZ: PreviousNthMarquerZ: the marquer with its position.no extension
TRUE if the given substring is bounded by the given bound(s).
1 examples run# the named-param shape is recognised
? Q(:IsBoundedBy = ".").IsIsBoundedByNamedParam()
# the direct check
? Q(".♥.").SubStringIsBoundedBy("♥", ".")
# the SubStringXT spelling
? Q(".♥.").SubStringXT("♥", :IsBoundedBy = ".")
#--> 1
#--> 1
#--> 1library testno extensionFindNextOccurrence
The position of the next occurrence of pcSub after the given position (0 when there is none).
composed example
o1 = new stzString("banana split")
? o1.FindNextOccurrence("an", 2)
#--> 4composed from the signature, run for this page no extensionUnicodesPerChar
The codepoint of each char, as a list.
composed example
o1 = new stzString("banana split")
? @@( o1.UnicodesPerChar() )
#--> [ [ "b", 98 ], [ "a", 97 ], [ "n", 110 ], [ "a", 97 ], [ "n", 110 ], [ "a", 97 ], [ " ", 32 ], [ "s", 115 ], [ "p", 112 ], [ "l", 108 ], [ "i", 105 ], [ "t", 116 ] ]composed from the signature, run for this page no extensionUnicodeOfChar
The codepoint of the given char.
composed example
o1 = new stzString("banana split")
? o1.UnicodeOfChar("a")
#--> 97composed from the signature, run for this page no extensionTurn the content into its hex digest with the given algorithm (mutating, engine-backed).
1 examples runalso named: digest checksum sha md5 fingerprinto1 = new stzString("original text before hashing")
o1.Hash(:MD5)
# the md5 hex digest
? o1.Content()
#--> 8ffad81de2e13a7b68c7858e4d60e263library testQCSXTZZZIBWUHashed
The hex digest of the content with the given algorithm, as data.no extension
EachCharBoxedRounded
Each char in its own rounded box cell.
also written: EachCharBoxRounded · EachCharBoxedRoundedDashedcomposed example
o1 = new stzString("banana split")
? o1.EachCharBoxedRounded()
#--> ╭───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───╮
#--> │ b │ a │ n │ a │ n │ a │ │ s │ p │ l │ i │ t │
#--> ╰───┴───┴───┴───┴───┴───┴───┴───┴───┴───┴───┴───╯composed from the signature, run for this page QCSXTZZZIBWUTitlecasedInLocale
The string titlecased for the given locale (falls back to plain titlecase).
composed example
o1 = new stzString("banana split")
? o1.TitlecasedInLocale("an")
#--> Banana Splitcomposed from the signature, run for this page no extensionCapitalisedInLocale
Same as Titlecased: The string in Title Case (each word capitalized).
composed example
o1 = new stzString("banana split")
? o1.CapitalisedInLocale("an")
#--> Banana Splitcomposed from the signature, run for this page no extensionCapitalizedInLocale
Same as Titlecased: The string in Title Case (each word capitalized).
composed example
o1 = new stzString("banana split")
? o1.CapitalizedInLocale("an")
#--> Banana Splitcomposed from the signature, run for this page no extensionFindPreviousOccurrence
The position of the nearest occurrence of pcSub before the given position (0 when there is none).
composed example
o1 = new stzString("banana split")
? o1.FindPreviousOccurrence("an", 2)
#--> 0composed from the signature, run for this page no extensionNumberOfLeadingItems
How long the leading char run is.
composed example
o1 = new stzString("banana split")
? o1.NumberOfLeadingItems()
#--> 1composed from the signature, run for this page no extensionNumberOfTrailingItems
How long the trailing char run is.
composed example
o1 = new stzString("banana split")
? o1.NumberOfTrailingItems()
#--> 1composed from the signature, run for this page no extensionRemoveRightOccurrence
Remove the LAST occurrence of pcSub (mutating).
composed example
o1 = new stzString("banana split")
o1.RemoveRightOccurrence("an")
? o1.Content()
#--> bana splitcomposed from the signature, run for this page QCSXTZZZIBWUContainsHybridOrientation
TRUE if the content mixes LTR (Latin) and RTL (Arabic-side) scripts.
composed example
o1 = new stzString("banana split")
? o1.ContainsHybridOrientation()
#--> 0composed from the signature, run for this page no extensionRepresentsSignedRealNumber
TRUE if the string is a SIGNED real-number literal.
composed example
o1 = new stzString("banana split")
? o1.RepresentsSignedRealNumber()
#--> 0composed from the signature, run for this page no extensionRepresentsUnsignedRealNumber
TRUE if the string is an UNSIGNED real-number literal.
composed example
o1 = new stzString("banana split")
? o1.RepresentsUnsignedRealNumber()
#--> 0composed from the signature, run for this page no extensionTRUE if the string is a 3-letter (long) language abbreviation (ISO 639-2/3).
1 examples runcomposed example
o1 = new stzString("banana split")
? o1.IsLongLanguageAbbreviation()
#--> 0composed from the signature, run for this page no extensionSame as RemoveLeadingChars: RemoveLeadingChars / RemoveTrailingChars / RemoveBoundingChars: strip every leading (or trailing, or both) char that matches the first (resp. last) char of the current content. Equivalent to the "trim run" interpretation in narrative tests.
1 examples runcomposed example
o1 = new stzString("banana split")
o1.RemoveLeadingAndTrailingChars()
? o1.Content()
#--> anana splicomposed from the signature, run for this page QCSXTZZZIBWUSubStringComesBetween is order-INDEPENDENT (matches the original): TRUE if pcSub sits between the two bounds in EITHER order.
1 examples runo1 = new stzString("---♥♥...**---")
# '...' comes between ♥♥ and ** (in order)
? o1.SubStringComesBetween("...", "♥♥", "**")
# and order-independently between ** and ♥♥
? o1.SubStringComesBetween("...", "**", "♥♥")
#--> 1
#--> 1library testno extensionTRUE if pcSub occurs BEFORE pcOther (a substring, or :Position = n).
1 examples runalso written: SubStringComesBeforeSubStringcomposed example
o1 = new stzString("banana split")
? o1.SubStringComesBefore("an", "an")
#--> 0composed from the signature, run for this page no extensionTRUE if pcSub occurs AFTER pcOther (a substring, or :Position = n).
1 examples runalso written: SubStringComesAfterSubStringcomposed example
o1 = new stzString("banana split")
? o1.SubStringComesAfter("an", "an")
#--> 0composed from the signature, run for this page no extensionTRUE if pcSub occurs before the given position.
1 examples runalso written: SubStringComesBeforePositioncomposed example
o1 = new stzString("banana split")
? o1.SubStringComesBeforePos("an", 2)
#--> 0composed from the signature, run for this page no extensionTRUE if pcSub occurs after the given position.
1 examples runalso written: SubStringComesAfterPositioncomposed example
o1 = new stzString("banana split")
? o1.SubStringComesAfterPos("an", 2)
#--> 0composed from the signature, run for this page no extensionTRUE if pcSub occurs between the two given positions.
1 examples runcomposed example
o1 = new stzString("banana split")
? o1.SubStringComesBetweenPositions("an", 2, 5)
#--> 1composed from the signature, run for this page no extensionInQ
Narrative-sub accessor used by SubStringQ(["sub", :In = "host"]). Stored as the LAST line of the wrapped content separated by char(1), so we don't need a class-level attribute that Haro would require declaring with the other @aContent slots. InQ(host): the host becomes the new content; the prior content is kept as the narrative sub.no extension
SubStringQ
Open a NARRATIVE chain about the given substring (ComesBefore / ComesAfter...).no extension
@
@(pcSub): narrative-set the subject substring; returns self.no extension
@RemoveItQ
@RemoveItQ(): remove every occurrence of the narrative sub.no extension
AndThenQ
Narrative glue: returns the object unchanged, chainable.no extension
AndQ
Narrative glue: returns the object unchanged, chainable.no extension
SpacifyItQ
Spacify the content (chars separated by spaces), chainable.no extension
SpacifyItR
The R-suffixed form returns the RESULT string (not the object).
composed example
o1 = new stzString("banana split")
? o1.SpacifyItR()
#--> b a n a n a s p l i tcomposed from the signature, run for this page no extension@0
Narrative closer: the content, as data (positional form).no extension
ComesBeforeSubString
Narrative form: TRUE if the chain's substring comes before the given one.
composed example
o1 = new stzString("banana split")
? o1.ComesBeforeSubString("an")
#--> 0composed from the signature, run for this page no extensionComesAfterSubString
Narrative form: TRUE if the chain's substring comes after the given one.
composed example
o1 = new stzString("banana split")
? o1.ComesAfterSubString("an")
#--> 0composed from the signature, run for this page no extensionComesBetweenPositions
Narrative form: TRUE if the chain's substring lies between the two positions.
composed example
o1 = new stzString("banana split")
? o1.ComesBetweenPositions(2, 5)
#--> 0composed from the signature, run for this page no extensionComesBeforePosition
Narrative form: TRUE if the chain's substring comes before the position.
composed example
o1 = new stzString("banana split")
? o1.ComesBeforePosition(2)
#--> 0composed from the signature, run for this page no extensionComesAfterPosition
Narrative form: TRUE if the chain's substring comes after the position.
composed example
o1 = new stzString("banana split")
? o1.ComesAfterPosition(2)
#--> 0composed from the signature, run for this page no extensionSubStringComesBetweenSubStrings
TRUE if pcSub occurs between the two given substrings.no extension
CharsAndTheirUnicodes
Each char paired with its codepoint (char first).
composed example
o1 = new stzString("banana split")
? @@( o1.CharsAndTheirUnicodes() )
#--> [ [ "b", 98 ], [ "a", 97 ], [ "n", 110 ], [ "a", 97 ], [ "n", 110 ], [ "a", 97 ], [ " ", 32 ], [ "s", 115 ], [ "p", 112 ], [ "l", 108 ], [ "i", 105 ], [ "t", 116 ] ]composed from the signature, run for this page no extensionToListInStringNF
The content as a list literal in normal form, as a string.
composed example
o1 = new stzString("banana split")
? o1.ToListInStringNF()
#--> [ "b", "a", "n", "a", "n", "a", " ", "s", "p", "l", "i", "t" ]composed from the signature, run for this page no extensionSectionBounds
SectionBounds(n1, n2, nLeftMax, nRightMax): the [open, close] bound substrings just before n1 and just after n2.
composed example
o1 = new stzString("banana split")
? @@( o1.SectionBounds(2, 5, 2, 2) )
#--> [ "b", "a " ]composed from the signature, run for this page QCSXTZZZIBWUFirstNonSpaceChar
The first non-space char of the string.
composed example
o1 = new stzString("banana split")
? o1.FirstNonSpaceChar()
#--> bcomposed from the signature, run for this page no extensionLastNonSpaceChar
The last non-space char of the string.
composed example
o1 = new stzString("banana split")
? o1.LastNonSpaceChar()
#--> tcomposed from the signature, run for this page no extensionFirstNonSpaceCharPosition
The position of the first non-space char.
also written: FindFirstNonSpaceCharcomposed example
o1 = new stzString("banana split")
? o1.FirstNonSpaceCharPosition()
#--> 1composed from the signature, run for this page no extensionLastNonSpaceCharPosition
The position of the last non-space char.
also written: FindLastNonSpaceCharcomposed example
o1 = new stzString("banana split")
? o1.LastNonSpaceCharPosition()
#--> 12composed from the signature, run for this page no extensionStringsW
Treat the content as a list of strings and filter by the W condition.no extension
Multiply EVERY number inside the string by n (mutating).
2 examples runalso written: MultipliedByNQCSXTZZZIBWUDivide every number inside the string by n (mutating).
2 examples runQCSXTZZZIBWUAdd n to every number inside the string (mutating).
2 examples runQCSXTZZZIBWUSubtract n from every number inside the string (mutating).
2 examples runQCSXTZZZIBWUSubtractN
Subtract n from every number inside the string (mutating).QCSXTZZZIBWU
FromUrl
URL fetch (stub: no network in this version; answers empty).no extension
Insert(pcSub, :BeforePosition = n / :AfterPosition = n / n).
3 examples runalso named: put at position add at place into injectcomposed example
o1 = new stzString("banana split")
o1.Insert("an", 2)
? o1.Content()
#--> bananana splitcomposed from the signature, run for this page QCSXTZZZIBWUWalkUntil
Walk the chars forward: the position where the condition first holds.
composed example
o1 = new stzString("banana split")
? o1.WalkUntil("@char = 'a'")
#--> 1composed from the signature, run for this page no extensionEachCharBoxedDashed
Each char in its own dashed box cell.
composed example
o1 = new stzString("banana split")
? o1.EachCharBoxedDashed()
#--> ┌╌╌╌┬╌╌╌┬╌╌╌┬╌╌╌┬╌╌╌┬╌╌╌┬╌╌╌┬╌╌╌┬╌╌╌┬╌╌╌┬╌╌╌┬╌╌╌┐
#--> ┊ b ┊ a ┊ n ┊ a ┊ n ┊ a ┊ ┊ s ┊ p ┊ l ┊ i ┊ t ┊
#--> └╌╌╌┴╌╌╌┴╌╌╌┴╌╌╌┴╌╌╌┴╌╌╌┴╌╌╌┴╌╌╌┴╌╌╌┴╌╌╌┴╌╌╌┴╌╌╌┘composed from the signature, run for this page no extensionThe string as boxed char cells with the occurrences of pcSub visually marked (the VizFind map, boxed).
1 examples runo1 = new stzString("..STZ..StZ..stz...STZ")
# bullets at 3, 8, 13 and 19
? o1.VizFindBoxedCSXT("STZ", :CS = FALSE, [ :Numbered = TRUE ])
#--> ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┐
#--> │ . │ . │ S │ T │ Z │ . │ . │ S │ t │ Z │ . │ . │ s │ t │ z │ . │ . │ . │ S │ T │ Z │
#--> └───┴───┴─•─┴───┴───┴───┴───┴─•─┴───┴───┴───┴───┴─•─┴───┴───┴───┴───┴───┴─•─┴───┴───┘library testQCSXTZZZIBWUVizFindBoxedRounded
The boxed VizFind map with rounded corners.no extension
VizFindBoxedDashed
The boxed VizFind map with dashed lines.no extension
VizFindManyXT2
Same as VizFindManyXT: Accept VizFindManyXT with single sub string or list.no extension
IsADigitInString
TRUE if the string is a single digit.
composed example
o1 = new stzString("banana split")
? o1.IsADigitInString()
#--> 0composed from the signature, run for this page no extensionFindSSZ
Section-bounded find: the positions of pcSub within n1..n2.
composed example
o1 = new stzString("banana split")
? @@( o1.FindSSZ("an", 2, 5) )
#--> [ 2, 4 ]composed from the signature, run for this page QCSXTZZZIBWUReplace the substring at each given position with its counterpart in the new list (mutating).
1 examples runo1 = new stzString("--[...]---[...]---[...]---[~~~]--[~~~]--")
o1.ReplaceSubStringAtPositionsByMany([ 27, 34 ], "[~~~]", [ "bbb", "aaa" ])
# each got its own name
? o1.Content()
#--> --[...]---[...]---[...]---bbb--aaa--library testno extensionToListInString(): the hosted list rendered in normal form (@@).
1 examples runcomposed example
o1 = new stzString("banana split")
? o1.ToListInString()
#--> [ "b", "a", "n", "a", "n", "a", " ", "s", "p", "l", "i", "t" ]composed from the signature, run for this page no extensionLanguageAbbreviationFor
The ISO 639-1 code for the given language name.no extension
LongLanguageAbbreviationFor
The 3-letter ISO 639-2/3 code for the given language name.no extension
SplitAroundSections
Split the string around the given sections (the sections excluded).
composed example
o1 = new stzString("banana split")
? @@( o1.SplitAroundSections([ "an", "a" ]) )
#--> [ "banana split" ]composed from the signature, run for this page QCSXTZZZIBWUSplitAroundSubStrings
Split around the occurrences of EACH given substring.
composed example
o1 = new stzString("banana split")
? @@( o1.SplitAroundSubStrings([ "an", "a" ]) )
#--> [ "b", " split" ]composed from the signature, run for this page QCSXTZZZIBWUSplitAroundSection
Split the string around one [start, end] section.QCSXTZZZIBWU
MarquersPositionsSortedInAscending
The marquer positions in ascending order.also written: MarkersPositionsSortedInAscendingno extension
MarquersPositionsSortedInDescending
The marquer positions in descending order.also written: MarkersPositionsSortedInDescendingno extension
The position of the nth occurrence after the given position (:Of = substring form).
1 examples runo1 = new stzString("12500;NAME;10;0")
# the next one from 1
? o1.NextOccurrence( :Of = ";", :StartingAt = 1 )
# the 2nd from 5
? o1.NextNthOccurrence( 2, :Of = ";", :StartingAt = 5)
#--> 6
#--> 11library testno extensionAn ascending-sorted copy of the chars; the original is unchanged.
2 examples runo1 = new stzString("73964532041")
# ascending
? o1.SortedInAscending()
# descending
? o1.SortedInDescending()
#--> 01233445679
#--> 97654433210library testno extensionA descending-sorted copy of the chars; the original is unchanged.
2 examples runo1 = new stzString("73964532041")
# ascending
? o1.SortedInAscending()
# descending
? o1.SortedInDescending()
#--> 01233445679
#--> 97654433210library testno extensionTRUE if the chars are sorted, ascending OR descending.
1 examples runcomposed example
o1 = new stzString("banana split")
? o1.IsSorted()
#--> 0composed from the signature, run for this page no extensionThe sorting order of the chars (:Ascending, :Descending, ...).
2 examples runcomposed example
o1 = new stzString("banana split")
? o1.SortingOrder()
#--> unsortedcomposed from the signature, run for this page no extensionSort the CHARS of the string in ascending order in place (mutating). For a copy, use Sorted.
1 examples runcomposed example
o1 = new stzString("banana split")
o1.Sort()
? o1.Content()
#--> aaabilnnpstcomposed from the signature, run for this page QCSXTZZZIBWUSortInAscending
Sort the chars in ascending order in place (mutating).
composed example
o1 = new stzString("banana split")
o1.SortInAscending()
? o1.Content()
#--> aaabilnnpstcomposed from the signature, run for this page QCSXTZZZIBWUSortInDescending
Sort the chars of the string in descending order in place (mutating).
composed example
o1 = new stzString("banana split")
o1.SortInDescending()
? o1.Content()
#--> tspnnlibaaacomposed from the signature, run for this page QCSXTZZZIBWULeadingSubStringRemove
Same as RemoveLeadingChars: RemoveLeadingChars / RemoveTrailingChars / RemoveBoundingChars: strip every leading (or trailing, or both) char that matches the first (resp. last) char of the current content. Equivalent to the "trim run" interpretation in narrative tests.no extension
RemoveLeadingSubString
Same as LeadingSubStringRemove: Same as RemoveLeadingChars: RemoveLeadingChars / RemoveTrailingChars / RemoveBoundingChars: strip every leading (or trailing, or both) char that matches the first (resp. last) char of the current content. Equivalent to the "trim run" interpretation in narrative tests.
composed example
o1 = new stzString("banana split")
o1.RemoveLeadingSubString()
? o1.Content()
#--> anana splitcomposed from the signature, run for this page no extensionA copy with the leading char run removed.
1 examples runcomposed example
o1 = new stzString("banana split")
? o1.LeadingCharsRemoved()
#--> anana splitcomposed from the signature, run for this page no extensionTrailingCharsRemoved
A copy with the trailing char run removed.
composed example
o1 = new stzString("banana split")
? o1.TrailingCharsRemoved()
#--> banana splicomposed from the signature, run for this page no extensionRemove the first n chars (mutating).
1 examples runo1 = new stzString("123BATISTA")
o1.RemoveNFirstChars(3)
# mutated in place
? o1.Content()
# or functionally
? StzStringQ("123BATISTA").FirstNCharsRemoved(3)
#--> BATISTA
#--> BATISTAlibrary testQCSXTZZZIBWURemove the last n chars (mutating).
1 examples runo1 = new stzString("BATISTA123")
o1.RemoveNLastChars(3)
# mutated in place
? o1.Content()
# or functionally
? StzStringQ("BATISTA123").LastNCharsRemoved(3)
#--> BATISTA
#--> BATISTAlibrary testQCSXTZZZIBWUBeginsWith(pcSub): TRUE iff content starts with pcSub.
1 examples runcomposed example
o1 = new stzString("banana split")
? o1.BeginsWith("an")
#--> 0composed from the signature, run for this page QCSXTZZZIBWUThe position of the nth occurrence of pcSub after the given position.
2 examples runcomposed example
o1 = new stzString("banana split")
? o1.FindNextNthOccurrence(2, "an", 5)
#--> 0composed from the signature, run for this page no extensionThe position of the nth occurrence before the given position.
1 examples runcomposed example
o1 = new stzString("banana split")
? o1.NthPreviousOccurrence(2, "an", 5)
#--> 2composed from the signature, run for this page no extensionFindPreviousNthOccurrence(n, :Of = sub, :StartingAt = pos): position of -- the n-th occurrence of sub BEFORE pos (0 if none). FindFirstPrevious / -- FindFirstNext are the n=1 shorthands. The nth occurrence of the substring from the given start position: the position(s).
1 examples runalso written: FindPreviousNthOccurrenceOfcomposed example
o1 = new stzString("banana split")
? o1.FindPreviousNthOccurrence(2, "an", 2)
#--> 0composed from the signature, run for this page no extensionThe first occurrence of the substring from the given start position: the position(s).
1 examples runalso written: FindFirstPreviousOccurrencecomposed example
o1 = new stzString("banana split")
? o1.FindFirstPrevious("an", 2)
#--> 0composed from the signature, run for this page no extensionThe first occurrence of the substring from the given start position: the position(s).
1 examples runalso written: FindFirstNextOccurrencecomposed example
o1 = new stzString("banana split")
? o1.FindFirstNext("an", 2)
#--> 2composed from the signature, run for this page no extensionThe distance in chars from the given position to the target.
2 examples runo1 = new stzString("---456---")
# the exclusive gap
? o1.DistanceTo("6", :StartingAt = 4)
# the inclusive XT distance
? o1.DistanceToXT("6", :StartingAt = 4)
#--> 1
#--> 3library testQCSXTZZZIBWUSTContainsTheLetters(pacLetters): TRUE iff content contains every letter in pacLetters (in any order).
1 examples runo1 = new stzString("Adoption of the plan B")
# contains the letters N and b
? o1.ContainsTheLetters([ "N", "b" ])
#--> 1library testno extensionFindSubStringBetween
FindSubStringBetween(pcSub, pcOpen, pcClose): positions of pcSub inside any pcOpen..pcClose section.no extension
ToStzText
ToStzText() -- bridge into the text-meaning domain (base/natural/stzText).no extension
PartsUsing
The parts of the string partitioned by the given expression's value.
composed example
o1 = new stzString("banana split")
? @@( o1.PartsUsing("@char = 'a'") )
#--> [ "b", "a", "n", "a", "n", "a", " split" ]composed from the signature, run for this page QCSXTZZZIBWUContainsNoOneOfThese(paSubStr): TRUE iff content contains NONE of the listed substrings.
1 examples runalso written: ContainsNoneOfTheseo1 = new stzString("abcdef")
# none present
? o1.ContainsNoOneOfThese([ "xy", "xyz", "mwb" ])
# de spoils it
? o1.ContainsNoOneOfThese([ "xy", "xyz", "de", "mwb" ])
#--> 1
#--> 0library testno extensionIsLowercased / IsUppercased: predicates over content's case form.
1 examples run# tunis is lowercased
? StzStringQ("tunis").IsLowercased()
# TUNIS is uppercased
? StzStringQ("TUNIS").IsUppercased()
# Tunis is titlecased
? StzStringQ("Tunis").IsTitlecased()
#--> 1
#--> 1
#--> 1library testno extensionTRUE if the string is in UPPER CASE.
1 examples run# tunis is lowercased
? StzStringQ("tunis").IsLowercased()
# TUNIS is uppercased
? StzStringQ("TUNIS").IsUppercased()
# Tunis is titlecased
? StzStringQ("Tunis").IsTitlecased()
#--> 1
#--> 1
#--> 1library testno extension(IsLowercase / IsUppercase already exist earlier.) HasThisCentralChar(pcChar): TRUE iff the central char is pcChar.
1 examples runcomposed example
o1 = new stzString("banana split")
? o1.HasThisCentralChar("an")
#--> 0composed from the signature, run for this page no extensionA copy with the last n chars removed.
1 examples runalso written: NLastCharsRemovedo1 = new stzString("BATISTA123")
o1.RemoveNLastChars(3)
# mutated in place
? o1.Content()
# or functionally
? StzStringQ("BATISTA123").LastNCharsRemoved(3)
#--> BATISTA
#--> BATISTAlibrary testno extensionA copy with the first n chars removed.
1 examples runalso written: NFirstCharsRemovedo1 = new stzString("123BATISTA")
o1.RemoveNFirstChars(3)
# mutated in place
? o1.Content()
# or functionally
? StzStringQ("123BATISTA").FirstNCharsRemoved(3)
#--> BATISTA
#--> BATISTAlibrary testno extensionIsTitleCased: every space-separated word starts with an uppercase letter; the rest of that word is lower.
1 examples run# tunis is lowercased
? StzStringQ("tunis").IsLowercased()
# TUNIS is uppercased
? StzStringQ("TUNIS").IsUppercased()
# Tunis is titlecased
? StzStringQ("Tunis").IsTitlecased()
#--> 1
#--> 1
#--> 1library testno extensionContainsLetters(): TRUE iff the content contains any letter.
1 examples runcomposed example
o1 = new stzString("banana split")
? o1.ContainsLetters()
#--> 1composed from the signature, run for this page no extensionThe chars in reverse order, as data; the original is unchanged.
2 examples runalso named: backwards text mirrored reversed stringalso written: Inversed# SOFTANZA backwards
? StzStringQ("SOFTANZA").CharsReversed()
# whitespace squeezed
? StzStringQ(" Softanza Near-natural Programming ").Simplified()
#--> AZNATFOS
#--> Softanza Near-natural Programminglibrary testno extensionIsAlmostAFunctionCall(): TRUE iff content roughly matches `identifier(...)` syntax.
1 examples run# a bare call
? StzStringQ('myfunc()').IsAlmostAFunctionCall()
# a call with args
? StzStringQ('my_func("name")').IsAlmostAFunctionCall()
#--> 1
#--> 1library testno extensionWalkBackwardW
WalkBackwardW(pcCondition | :StartingAt = N, :UntilBefore = expr): walk content backwards from a starting position; returns the first position where the :UntilBefore predicate is TRUE (named-param form), or all positions where pcCondition is TRUE (string form).
composed example
o1 = new stzString("banana split")
? @@( o1.WalkBackwardW("@char = 'a'", 2) )
#--> [ 6, 4, 2 ]composed from the signature, run for this page no extensionReplaceNthCharQ alias. Replace the char at position n with the given one (chainable).
1 examples run# positional
? StzStringQ("évènement").ReplaceNthCharQ(3, "*").Content()
# named
? StzStringQ("évènement").ReplaceNthCharQ(3, :With = "*").Content()
#--> év*nement
#--> év*nementlibrary testno extensionCharQ
The char at position n, wrapped as a stzChar object.no extension
PartsClassifiedUsing
Same as PartsClassifiedUsingXT: The parts grouped by their partitioner value: [ [value, [parts...]], ... ].
composed example
o1 = new stzString("banana split")
? @@( o1.PartsClassifiedUsing("@char = 'a'") )
#--> [ [ 0, [ "b", "n", "n", " split" ] ], [ 1, [ "a", "a", "a" ] ] ]composed from the signature, run for this page QCSXTZZZIBWUPartsAndPartitionersUsingXT
Each part zipped with its partitioner value (the expression's result for it).
also written: Parts2Usingcomposed example
o1 = new stzString("banana split")
? @@( o1.PartsAndPartitionersUsingXT("@char = 'a'") )
#--> [ [ "b", 0 ], [ "a", 1 ], [ "n", 0 ], [ "a", 1 ], [ "n", 0 ], [ "a", 1 ], [ " split", 0 ] ]composed from the signature, run for this page QCSXTZZZIBWUReplaceAllChars(pcOld, pcNew): char-by-char map. ReplaceAllChars: (:With = pcNew) : replace every char with pcNew Two-arg (pcOld, pcNew) form lives in ReplaceAllCharsXT.
1 examples runo1 = new stzString("Use these two letters: س and ص.")
o1.ReplaceAllChars( :With = "*" )
# as many stars as chars
? o1.Content()
#--> *******************************library testQCSXTZZZIBWUHow many chars satisfy the W condition.
1 examples run# counting the lowercase "a" gives 3
? Q("SoftAnza Libraray").CountCharsW('@char = "a"')
# counting "a" case-insensitively (a or A) gives 4
? Q("SoftAnza Libraray").CountCharsW('(@char = "a") or (@char = "A")')
#--> 3
#--> 4library testno extensionNthSubStringAfterSplittingStringUsing(n, pcSep): the n-th piece after splitting on pcSep.
1 examples runo1 = new stzString("abc;123;gafsa;ykj")
# via SplitQ
? o1.SplitQ(";").NthItem(3)
# via the long natural name
? o1.NthSubstringAfterSplittingStringUsing(3, ";")
#--> gafsa
#--> gafsalibrary testno extensionSame as ContainsEachCS: ContainsEachCS(pacSubStr, pCaseSensitive): TRUE iff content contains every listed substring.
1 examples runcomposed example
o1 = new stzString("banana split")
? o1.ContainsEach([ "an", "a" ])
#--> 1composed from the signature, run for this page QCSXTZZZIBWUContainsEachOfThese
Same as ContainsEachCS: ContainsEachCS(pacSubStr, pCaseSensitive): TRUE iff content contains every listed substring.
composed example
o1 = new stzString("banana split")
? o1.ContainsEachOfThese([ "an", "a" ])
#--> 1composed from the signature, run for this page QCSXTZZZIBWUMultiplyBy(n): repeat content n times. MultiplyBy(list): distribute -- "a" x ["b","c"] -> "ab" + "ac".
1 examples runo1 = new stzString("a")
o1.MultiplyBy([ "b", "c", "d" ])
# ab + ac + ad
? o1.Content()
#--> abacadlibrary testQCSXTZZZIBWUReplaceFirstNChars
ReplaceFirstNChars(n, pcNew): replace the first n chars with pcNew.
composed example
o1 = new stzString("banana split")
o1.ReplaceFirstNChars(2, "AN")
? o1.Content()
#--> ANnana splitcomposed from the signature, run for this page QCSXTZZZIBWUReplaceLastNChars
Replace the last n chars with the given string (mutating).
composed example
o1 = new stzString("banana split")
o1.ReplaceLastNChars(2, "AN")
? o1.Content()
#--> banana splANcomposed from the signature, run for this page QCSXTZZZIBWUReplaceNthOccurrence
Replace only the nth occurrence of pcSub with pcNew (mutating).
composed example
o1 = new stzString("banana split")
o1.ReplaceNthOccurrence(2, "an", "AN")
? o1.Content()
#--> banANa splitcomposed from the signature, run for this page QCSXTZZZIBWURemoveFirstOccurrence(pcSub) -- accepts :Of = pcSub.
1 examples runo1 = new stzString("LandRingoriaLand")
o1.RemoveFirstOccurrence( :Of = "Land")
# the trailing one stays
? o1.Content()
#--> RingoriaLandlibrary testQCSXTZZZIBWUOrientation
Orientation(): :LTR for normal scripts, :RTL when first char is Arabic/Hebrew/etc.
composed example
o1 = new stzString("banana split")
? o1.Orientation()
#--> ltrcomposed from the signature, run for this page no extensionRemoveNLeftChars / RemoveNRightChars aliases.
2 examples runo1 = new stzString("سلام لأهل مصر الكرام")
o1.RemoveNLeftChars(7)
# the head is gone, string-order
? o1.Content()
#--> هل مصر الكرامlibrary testQCSXTZZZIBWUSame as RemoveNLastChars: Remove the last n chars (mutating).
1 examples runo1 = new stzString("eeebxeTuniseee")
o1.RemoveNLeftChars(3)
o1.RemoveNRightChars(3)
# the middle remains
? o1.Content()
#--> bxeTunislibrary testQCSXTZZZIBWUReplace the occurrences of pcSub cycling through the given replacements (same as ReplaceByMany).
1 examples runo1 = new stzString("--Ring--Softanza--")
o1.ReplaceWithMany("--", [ "1", "2", "3" ])
# the three '--' get 1, 2, 3
? o1.Content()
#--> 1Ring2Softanza3library testQCSXTZZZIBWUReplace each substring with its same-index counterpart (pairwise, mutating).
1 examples runo1 = new stzString("--Ring__Softanza..")
o1.ReplaceManyWithMany([ "--", "__", ".." ], [ "1", "2", "3" ])
# -- / __ / .. become 1 / 2 / 3
? o1.Content()
#--> 1Ring2Softanza3library testQCSXTZZZIBWUAlignedXT(:Width = n, :PadChar = " ", :Direction = :Left/:Right/:Center)
1 examples run# eleven dots each side
? Q("SFOTANZA").AlignedXT( :Width = 30, :Char = ".", :Direction = :Center )
#--> ...........SFOTANZA...........library testno extensionCompressUsingBinary(pcMask): keep the chars whose mask bit is "1", drop the "0" ones ("ABCDEFGH" x "10011011" -> "ADEGH").
1 examples runo1 = new stzString("ABCDEFGH")
o1.CompressUsingBinary("10011011")
# the 1-bits survive
? o1.Content()
#--> ADEGHlibrary testQCSXTZZZIBWUSame as UnicodeCompareWithCS: UnicodeCompareWithCS(pcOther, pCaseSensitive): codepoint comparison. Returns :Less, :Equal or :Greater.
1 examples runcomposed example
o1 = new stzString("banana split")
? o1.UnicodeCompareWith("an")
#--> greatercomposed from the signature, run for this page QCSXTZZZIBWULocale-flavored Unicode comparison with the given string.
1 examples run# RESERVE beats reserve on the tie-break
? Q("RÉSERVÉ").UnicodeCompareWithInSystemLocale("réservé")
#--> greaterlibrary testno extensionContainsLetter(pcLetter): TRUE iff content contains pcLetter.
1 examples runcomposed example
o1 = new stzString("banana split")
? o1.ContainsLetter("an")
#--> 1composed from the signature, run for this page no extensionContainsBoth(pcA, pcB): TRUE iff content contains BOTH.
1 examples runo1 = new stzString("ar_TN-tun")
# contains each of _ and -
? o1.ContainsEachCS([ "_", "-" ], TRUE)
# contains both
? o1.ContainsBoth("_", "-")
#--> 1
#--> 1library testno extensionNumericValue
NumericValue(): content as a number.no extension
NumberValue
The numeric value of the content. ring_number() not 0+ : Haro's 0+str coercion returns 0 on the first use after ANY caught raise (VM quirk); ring_number() is immune.no extension
IsALetterOf(pcOther): TRUE iff single-char This appears in pcOther.
1 examples runcomposed example
o1 = new stzString("banana split")
? o1.IsALetterOf("an")
#--> 0composed from the signature, run for this page no extensionRemoveLeftOccurrence
Same as RemoveFirstOccurrence: RemoveFirstOccurrence(pcSub) -- accepts :Of = pcSub.
composed example
o1 = new stzString("banana split")
o1.RemoveLeftOccurrence("an")
? o1.Content()
#--> bana splitcomposed from the signature, run for this page QCSXTZZZIBWUPositionAfter
PositionAfter(pcSub): position right after first occurrence.
composed example
o1 = new stzString("banana split")
? o1.PositionAfter("an")
#--> 4composed from the signature, run for this page no extensionPositionBefore
The position just BEFORE the first occurrence of pcSub.
composed example
o1 = new stzString("banana split")
? o1.PositionBefore("an")
#--> 1composed from the signature, run for this page no extensionInsertSubStrings(anPos, pacStr): insert pacStr[i] at anPos[i], processed from highest position down so earlier positions stay valid.
3 examples runo1 = new stzString("All our software versions must be updated!")
o1.InsertSubStrings( o1.PositionAfter("versions"), [ "V1", "V2", "V3" ])
# parenthesized with padding spaces
? o1.Content()
#--> All our software versions (V1, V2, V3) must be updated!library testQCSXTZZZIBWUItemsWhere
Same as CharsW: (IsTitlecased -- Haro is case-insensitive, just one def.) CharsW(pcCondition): the characters where the predicate is TRUE (predicate-driven char filter).
composed example
o1 = new stzString("banana split")
? @@( o1.ItemsWhere("@char = 'a'") )
#--> [ "a", "a", "a" ]composed from the signature, run for this page no extensionIsShortLanguageAbbreviation(): 2-letter ISO 639-1-style alpha code.
1 examples runcomposed example
o1 = new stzString("banana split")
? o1.IsShortLanguageAbbreviation()
#--> 0composed from the signature, run for this page no extensionIsLatin(): TRUE iff every char is ASCII-Latin.
1 examples run# Latin script
? StzStringQ("Ⅱ").IsLatin()
# and a Roman number
? StzCharQ("Ⅱ").IsRomanNumber()
#--> 1
#--> 1library testno extensionContainsNOccurrences
TRUE if pcSub occurs exactly n times.
composed example
o1 = new stzString("banana split")
? o1.ContainsNOccurrences(2, "an")
#--> 1composed from the signature, run for this page QCSXTZZZIBWUEXTRACT the digits as one string ("number 125" -> "125").
1 examples runalso written: OnlyDigits# digits only
? Q("number 12500 number 18200").OnlyNumbers()
#--> 1250018200library testno extensionPad the string to length n with spaces (mutating).
1 examples runo1 = new stzString("ABC")
o1.ExtendTo(5)
# it is padded to width 5 with spaces
? o1.Content()
#--> ABClibrary testQCSXTZZZIBWURemove pcSub only where it is bounded by the given bounds (mutating).
1 examples runo1 = new stzString("__^^^__^^♥^^__")
o1.RemoveSubStringBoundedBy("♥", "^^")
# heart gone, carets stay
? o1.Content()
#--> __^^^__^^^^__library testQCSXTZZZIBWUSame as RemoveNFirstChars: Remove the first n chars (mutating).
1 examples runcomposed example
o1 = new stzString("banana split")
o1.RemoveNCharsLeft(2)
? o1.Content()
#--> nana splitcomposed from the signature, run for this page QCSXTZZZIBWUSame as RemoveNLastChars: Remove the last n chars (mutating).
1 examples runcomposed example
o1 = new stzString("banana split")
o1.RemoveNCharsRight(2)
? o1.Content()
#--> banana splcomposed from the signature, run for this page QCSXTZZZIBWUBoxEachChar
Box each char in its own cell, in place (mutating).QCSXTZZZIBWU
CharsBoxed
Each char in its own box cell, as data.
composed example
o1 = new stzString("banana split")
? o1.CharsBoxed()
#--> ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┐
#--> │ b │ a │ n │ a │ n │ a │ │ s │ p │ l │ i │ t │
#--> └───┴───┴───┴───┴───┴───┴───┴───┴───┴───┴───┴───┘composed from the signature, run for this page no extensionBox each char in its own cell, in place (mutating).
2 examples runo1 = new stzString("SOFTANZA")
o1.BoxifyChars()
# eight cells
? o1.Content()
#--> ┌───┬───┬───┬───┬───┬───┬───┬───┐
#--> │ S │ O │ F │ T │ A │ N │ Z │ A │
#--> └───┴───┴───┴───┴───┴───┴───┴───┘library testQCSXTZZZIBWUFindAnyBoundedByAsSectionss
Same as FindAnyBoundedByAsSections, the pair given as two args.no extension
ReplaceOccurrences: (pcOld, pcNew) : every-occurrence replace (anN, :Of = pcOld, :By = pcNew | listOfReplacements) : selected n-th occurrences
1 examples runo1 = new stzString("--[...]---[...]---[...]---[~~~]--[~~~]--")
o1.ReplaceOccurrences([ 2, :and = 3 ], :of = "[...]", :by = [ "ONE", :and = "TWO" ])
# first block untouched
? o1.Content()
#--> --[...]---ONE---TWO---[~~~]--[~~~]--library testQCSXTZZZIBWUFindConsecutiveSubStringsOfNChars
FindConsecutiveSubStringsOfNChars(n): the unique phase offsets that carry at least one full window (the original returns U(XT) over the per-window phase labels).
composed example
o1 = new stzString("banana split")
? @@( o1.FindConsecutiveSubStringsOfNChars(2) )
#--> [ 1, 2 ]composed from the signature, run for this page QCSXTZZZIBWUStringCase(): return :Lowercase, :Uppercase, :TitleCase, or :Mixed.
2 examples run# its script reads latin
? TQ("ı").Script()
# it is lowercase
? Q("ı").StringCase()
# its dotted capital is uppercase
? Q("İ").StringCase()
#--> latin
#--> lowercase
#--> uppercaselibrary testno extensionFindBoundedBy
Same as FindBoundedByCS: FindBoundedBy / FindBoundedByCS -- the most common spelling in narrative tests. Returns the [startPos, endPos] of each bounded section. FindBoundedBy: the content START positions of the bounded regions (the ZZ / AsSections forms carry the spans).
composed example
o1 = new stzString("banana split")
? @@( o1.FindBoundedBy([ "an", "a" ]) )
#--> [ 4, 6 ]composed from the signature, run for this page QCSXTZZZIBWUSame as IsBoundedByCS: IsBoundedByCS / IsBoundedBy: predicate. True iff the content starts with pacBounds[1] AND ends with pacBounds[2].
6 examples run# braced
? StzStringQ("{nnnnn}").IsBoundedBy([ "{", "}" ])
o1 = new stzString("بسم الله الرّحمن الرّحيم")
# opens with bism, closes with arrahim
? o1.IsBoundedBy([ "بسم", "الرّحيم" ])
#--> 1
#--> 1library testQCSXTZZZIBWUFindDuplicatesAsSections
(no comment in the source: the name reads as a sentence) find duplicates as sectionsin the section finder delegations (expanded)composed example
o1 = new stzString("banana split")
? @@( o1.FindDuplicatesAsSections() )
#--> [ [ 4, 4 ], [ 4, 5 ], [ 4, 6 ], [ 5, 5 ], [ 5, 6 ], [ 6, 6 ] ]composed from the signature, run for this page QCSXTZZZIBWU (no comment in the source: the name reads as a sentence) find chars w 4 examples runin the section finder delegations (expanded)# FindCharsW reports the positions of "I"
? @@( Q("KALIDIA").FindCharsW('@char = "I"') )
#--> [ 4, 6 ]library testQCSXTZZZIBWU CharsBetween
The chars between the two given positions, as a list.
composed example
o1 = new stzString("banana split")
? o1.CharsBetween(2, 5)
#--> nacomposed from the signature, run for this page no extensionFindFirstRegex
(no comment in the source: the name reads as a sentence) find first regexalso written: FindRegexin the section finder delegations (expanded)composed example
o1 = new stzString("banana split")
? o1.FindFirstRegex("an")
#--> 2composed from the signature, run for this page QCSXTZZZIBWU FindAllRegex
(no comment in the source: the name reads as a sentence) find all regexalso written: FindAllRegexMatchesin the section finder delegations (expanded)composed example
o1 = new stzString("banana split")
? @@( o1.FindAllRegex("an") )
#--> [ 2, 4 ]composed from the signature, run for this page QCSXTZZZIBWU CountSubStrings
Note: NumberOfSubStrings / NumberOfSubStringsCS / NumberOfSubStringsU without args (combinatorial enumeration count) are defined at the class top with the SubStrings group; here we keep only the differently-named occurrence-count alias for clarity.
composed example
o1 = new stzString("banana split")
? o1.CountSubStrings("an")
#--> 2composed from the signature, run for this page no extensionSame as CountCS: How many times the given substring occurs.
5 examples runalso written: NumberOfOccurrencescomposed example
o1 = new stzString("banana split")
? o1.Count("an")
#--> 2composed from the signature, run for this page QCSXTZZZIBWUCountOverlapping
Same as CountOverlappingCS: How many times it occurs, counting OVERLAPPING matches.
composed example
o1 = new stzString("banana split")
? o1.CountOverlapping("an")
#--> 2composed from the signature, run for this page QCSXTZZZIBWUCountLeadingChar
count leading / trailing char
composed example
o1 = new stzString("banana split")
? o1.CountLeadingChar("an")
#--> 0composed from the signature, run for this page no extensionCountTrailingChar
count leading / trailing char
composed example
o1 = new stzString("banana split")
? o1.CountTrailingChar("an")
#--> 0composed from the signature, run for this page no extensionCountRegex
How many matches of the given regex pattern.
composed example
o1 = new stzString("banana split")
? o1.CountRegex("an")
#--> 2composed from the signature, run for this page QCSXTZZZIBWUIsEither
IsEither(a, :Or = b): TRUE when the content equals either value (string-side override; unwraps the :Or named param).
composed example
o1 = new stzString("banana split")
? o1.IsEither(3, 4)
#--> 0composed from the signature, run for this page QCSXTZZZIBWUsplit at -- dispatcher (case-sensitive by default)
2 examples runcomposed example
o1 = new stzString("banana split")
? @@( o1.SplitAt(" ") )
#--> [ "banana", "split" ]composed from the signature, run for this page QCSXTZZZIBWUSplitBefore
Same as SplitBeforeCS: Split the string before each occurrence of the separator (it starts each new part).
composed example
o1 = new stzString("banana split")
? @@( o1.SplitBefore("an") )
#--> [ "b", "an", "ana split" ]composed from the signature, run for this page QCSXTZZZIBWUSplitBefore positions / char- or substring-predicate variants.
2 examples run# the pieces start at 4 and 8
? @@( Q("---4---8---").SplitBeforePositions([ 4, 8 ]) )
#--> [ "---", "4---", "8---" ]library testno extensionSplit so each given position ENDS a piece.
1 examples run# the pieces end at 4 and 8
? @@( Q("---4---8---").SplitAfterPositions([ 4, 8 ]) )
#--> [ "---4", "---8", "---" ]library testno extensionSplitBeforeCharsW(pcCondition): split into pieces that begin at each char where the predicate is TRUE. Engine-backed via FindCharsW (no eval). Replaces the retired SplitBeforeCharsWXT.
1 examples run# SplitBeforeCharsW at the uppercase letters yields the words
? @@( Q("NoWomanNoCry").SplitBeforeCharsW('Q(@char).IsUppercase()') )
#--> [ "No", "Woman", "No", "Cry" ]library testno extensionSplitAfterCharsW
Split after each char satisfying the W condition.
composed example
o1 = new stzString("banana split")
? @@( o1.SplitAfterCharsW("@char = 'a'") )
#--> [ "ba", "na", "na", " split" ]composed from the signature, run for this page no extensionSplitBeforeSubStringsW
SplitBeforeSubStringsW(pcCondition): split before each substring matching the predicate. Engine-backed (see _SubStringMatchPositions), no eval(). Replaces the retired SplitBeforeSubStringsWXT.
composed example
o1 = new stzString("banana split")
? @@( o1.SplitBeforeSubStringsW("@char = 'a'") )
#--> [ "banana split" ]composed from the signature, run for this page no extensionSplitAfterSubStringsW
Split after each substring matching the W condition.
composed example
o1 = new stzString("banana split")
? @@( o1.SplitAfterSubStringsW("@char = 'a'") )
#--> [ "banana split" ]composed from the signature, run for this page no extensionSplitAtSubStringsW
SplitAtSubStringsW(pcCondition): split AT the substrings matching the predicate -- the matched substrings are dropped (delimiters), the pieces between are returned. Engine-backed (W) and anonymous-function (WF) forms, no eval().
composed example
o1 = new stzString("banana split")
? @@( o1.SplitAtSubStringsW("@char = 'a'") )
#--> [ "banana split" ]composed from the signature, run for this page QCSXTZZZIBWUFSplitAfter
Same as SplitAfterCS: Split the string after each occurrence of the separator (the separator stays with its part).
composed example
o1 = new stzString("banana split")
? @@( o1.SplitAfter("an") )
#--> [ "ban", "an", "a split" ]composed from the signature, run for this page QCSXTZZZIBWUSplitAround
Same as SplitAroundCS: The pieces between the occurrences of pcSubStr (codepoint-aware).
also written: SplitAroundSubStringcomposed example
o1 = new stzString("banana split")
? @@( o1.SplitAround("an") )
#--> [ "b", "", "a split" ]composed from the signature, run for this page QCSXTZZZIBWUPartition
The [before, match, after] triple around the FIRST occurrence.
composed example
o1 = new stzString("banana split")
? @@( o1.Partition("an") )
#--> [ "b", "an", "ana split" ]composed from the signature, run for this page no extensionRPartition
The [before, match, after] triple around the LAST occurrence.
composed example
o1 = new stzString("banana split")
? @@( o1.RPartition("an") )
#--> [ "ban", "an", "a split" ]composed from the signature, run for this page no extensionSplitByRegex
Split the string on the matches of the given regex pattern.
composed example
o1 = new stzString("banana split")
? @@( o1.SplitByRegex("an") )
#--> [ "b", "", "a split" ]composed from the signature, run for this page QCSXTZZZIBWUSplitAtPosition
Split the string at the given position.
composed example
o1 = new stzString("banana split")
? @@( o1.SplitAtPosition(2) )
#--> [ "b", "nana split" ]composed from the signature, run for this page no extensionSplitAtPositions
Split the string at the given positions.no extension
InsertBeforeSubString
Same as InsertBeforeSubStringCS: inserting before / after all occurrences
composed example
o1 = new stzString("banana split")
o1.InsertBeforeSubString("an", "an")
? o1.Content()
#--> banananana splitcomposed from the signature, run for this page QCSXTZZZIBWUInsertAfterSubString
Same as InsertAfterSubStringCS: inserting before / after all occurrences
composed example
o1 = new stzString("banana split")
o1.InsertAfterSubString("an", "an")
? o1.Content()
#--> banananana splitcomposed from the signature, run for this page QCSXTZZZIBWUInsertBeforeFirst
Same as InsertBeforeFirstCS: inserting before first / last occurrence
composed example
o1 = new stzString("banana split")
o1.InsertBeforeFirst("an", "an")
? o1.Content()
#--> bananana splitcomposed from the signature, run for this page QCSXTZZZIBWUInsertAfterFirst
Same as InsertAfterFirstCS: inserting after first / last occurrence
composed example
o1 = new stzString("banana split")
o1.InsertAfterFirst("an", "an")
? o1.Content()
#--> bananana splitcomposed from the signature, run for this page QCSXTZZZIBWUInsertBeforeLast
Same as InsertBeforeLastCS: inserting before first / last occurrence
composed example
o1 = new stzString("banana split")
o1.InsertBeforeLast("an", "an")
? o1.Content()
#--> bananana splitcomposed from the signature, run for this page QCSXTZZZIBWUInsertAfterLast
Same as InsertAfterLastCS: inserting after first / last occurrence
composed example
o1 = new stzString("banana split")
o1.InsertAfterLast("an", "an")
? o1.Content()
#--> bananana splitcomposed from the signature, run for this page QCSXTZZZIBWUInsertBeforeNth
Same as InsertBeforeNthCS: inserting before nth occurrence
composed example
o1 = new stzString("banana split")
o1.InsertBeforeNth(2, "an", "an")
? o1.Content()
#--> bananana splitcomposed from the signature, run for this page QCSXTZZZIBWUInsertAfterNth
Same as InsertAfterNthCS: inserting after nth occurrence
composed example
o1 = new stzString("banana split")
o1.InsertAfterNth(2, "an", "an")
? o1.Content()
#--> bananana splitcomposed from the signature, run for this page QCSXTZZZIBWURemoveCharAt
Same as RemoveSection: Remove the chars at positions n1..n2 (mutating).
composed example
o1 = new stzString("banana split")
o1.RemoveCharAt(2)
? o1.Content()
#--> bnana splitcomposed from the signature, run for this page no extensionRemoveAtPosition
Same as RemoveSection: Remove the chars at positions n1..n2 (mutating).
composed example
o1 = new stzString("banana split")
o1.RemoveAtPosition(2)
? o1.Content()
#--> bnana splitcomposed from the signature, run for this page no extensionRemoveSpaces
Remove all the spaces (mutating).
composed example
o1 = new stzString("banana split")
o1.RemoveSpaces()
? o1.Content()
#--> bananasplitcomposed from the signature, run for this page QCSXTZZZIBWURemoveSpacesInSections
RemoveSpacesInSections(aSections): remove every space inside the given [n1, n2] sections. Walks sections in descending start-pos order so earlier sections stay valid after later edits.QCSXTZZZIBWU
RemoveLeadingSpaces
Same as TrimLeft: Remove the leading spaces in place (mutating). For a copy, use TrimmedLeft.no extension
RemoveTrailingSpaces
Same as TrimRight: Remove the trailing spaces in place (mutating). For a copy, use TrimmedRight.no extension
WithoutSpaces / SpacesRemoved: return the content with every space character removed, without mutating This. Ported from archive line 89601-89614.
1 examples runalso written: WithoutSapces · WithoutSpacescomposed example
o1 = new stzString("banana split")
? o1.SpacesRemoved()
#--> bananasplitcomposed from the signature, run for this page QCSXTZZZIBWUSame as SubStringsSpacifiedCS: SubStringsSpacifiedCS / TheseSubstringsSpacifiedCS: wrap every occurrence of any substring in pacSubStr with spaces in the string content, return result. Used by stzCCode.Transpile to normalise token boundaries for downstream regex passes. Ported from archive line 91253; implementation collapses to a simple repeated substr-replace (Haro's built-in is global). Case-insensitive path uses a case-folded scan + position-aware splice so the result preserves the original casing of non-matched chars.
2 examples runalso written: TheseSpacified · TheseSubstringsSpacifiedo1 = new stzString("iloveringprogramminglanguage")
? o1.TheseSubStringsSpacified([ "php", "ruby" ]) # Nothing happens because these substrings
#--> iloveringprogramminglanguagelibrary testQCSXTZZZIBWUSame as SpacifySubStringsUsingCS: SpacifySubStringsUsing: in-place variant of SubStringsSpacified that lets the caller choose the separator (default would be a single space; this form makes it explicit). Wraps every occurrence of each substring in pacSubStr with the given separator on both sides. SpacifySubStringsUsingCS: find ALL the substrings' sections at once (sorted), drop the ones strictly included in their predecessor (so "in" inside "Haro" survives as part of "Haro"), bound each kept section with the separator on BOTH sides, then collapse duplicate separators (adjacent tokens share one) and strip them from the edges. Satisfies the archive triple: blocks 133, 306, 307.
2 examples runo1 = new stzString("whatisyournameplease?")
o1.SpacifySubStringsUsing(["is", "your", "name"], "_")
? o1.Content()
#--> what_is_your_name_please?library testQCSXTZZZIBWUSpacifySubStringUsing
Separate the chars of pcSub inside the string with the given separator (mutating).no extension
SpacifySubStrings
Spacify every occurrence of the given substrings (mutating).no extension
AddXT(cBoth, :Around = "p") Shortcut for [cBoth, cBoth] -- same separator on both sides.
14 examples runo1 = new stzString("__♥__♥__♥__")
o1.AddXT(" ", :AroundEach = "♥")
# every heart breathes
? o1.Content()
#--> __ ♥ __ ♥ __ ♥ __library testQCSXTZZZIBWUFindAnySubStringBoundedByZZ
Same as FindSubStringsBoundedByZZ: FindSubStringsBoundedByZZ: exclusive-bounds variant. Returns the position-pair list for the INNER content (without the bound chars). Derived from the IB result by shifting the start past the open token and the end before the close token.
composed example
o1 = new stzString("banana split")
? @@( o1.FindAnySubStringBoundedByZZ([ "an", "a" ]) )
#--> [ [ 4, 3 ] ]composed from the signature, run for this page no extensionFindAnySubStringsBoundedByZZ
Same as FindSubStringsBoundedByZZ: FindSubStringsBoundedByZZ: exclusive-bounds variant. Returns the position-pair list for the INNER content (without the bound chars). Derived from the IB result by shifting the start past the open token and the end before the close token.
composed example
o1 = new stzString("banana split")
? @@( o1.FindAnySubStringsBoundedByZZ([ "an", "a" ]) )
#--> [ [ 4, 3 ] ]composed from the signature, run for this page no extensionRemoveThisTrailingChar: strip repeated trailing occurrences of a single given char. "abc!!" + RemoveThisTrailingChar("!") -> "abc". Ported from the legacy monolithic archive (~line 27306-27389); standalone byte-level implementation that avoids cascading dependencies on FindRepeatedTrailingChars*.
1 examples runo1 = new stzString("12.4560000")
o1.RemoveThisTrailingChar("0")
# mutated in place
? o1.Content()
# or functionally
? Q("12.45600").ThisTrailingCharRemoved("0")
#--> 12.456
#--> 12.456library testQCSXTZZZIBWUA copy with the trailing run of the given char removed.
1 examples runo1 = new stzString("12.4560000")
o1.RemoveThisTrailingChar("0")
# mutated in place
? o1.Content()
# or functionally
? Q("12.45600").ThisTrailingCharRemoved("0")
#--> 12.456
#--> 12.456library testno extensionThisLeadingCharRemoved
A copy with the leading run of the given char removed.no extension
RemoveThisRepeatedTrailingChar
Same as RemoveThisTrailingChar: RemoveThisTrailingChar: strip repeated trailing occurrences of a single given char. "abc!!" + RemoveThisTrailingChar("!") -> "abc". Ported from the legacy monolithic archive (~line 27306-27389); standalone byte-level implementation that avoids cascading dependencies on FindRepeatedTrailingChars*.QCSXTZZZIBWU
RemoveThisTrailingRepeatedChar
Same as RemoveThisTrailingChar: RemoveThisTrailingChar: strip repeated trailing occurrences of a single given char. "abc!!" + RemoveThisTrailingChar("!") -> "abc". Ported from the legacy monolithic archive (~line 27306-27389); standalone byte-level implementation that avoids cascading dependencies on FindRepeatedTrailingChars*.QCSXTZZZIBWU
Remove the leading run of the given char from the start of the string (mutating, codepoint-aware).
2 examples runo1 = new stzString("000122.12")
# the leading char
? o1.LeadingChar()
o1.RemoveThisLeadingChar("0")
# the run is gone
? o1.Content()
#--> 0
#--> 122.12library testQCSXTZZZIBWURemoveDuplicates
Same as RemoveDuplicatesCS: Remove the 2nd+ occurrences of each duplicated char, keeping the first (mutating).QCSXTZZZIBWU
Same as RemoveFromLeftCS: removing substring from left / right
1 examples runo1 = new stzString("let's say welcome to everyone!")
o1.RemoveFromLeft("let's say ")
# the lead is gone
? o1.Content()
#--> welcome to everyone!library testQCSXTZZZIBWUSame as RemoveFromRightCS: Remove pcSubStr from the visual RIGHT end (direction-aware, mutating).
1 examples runo1 = new stzString("هذه الكلمات الّتي سوف تبقى")
# the right 4 chars open the text
? o1.NRightCharsAsSubstring(4)
o1.RemoveFromRight("هذه ")
# removing from the right trims the start
? o1.Content()
#--> هذه
#--> الكلمات الّتي سوف تبقىlibrary testQCSXTZZZIBWURemove nRange chars starting at nStart (mutating).
1 examples runo1 = new stzString("extrasection")
o1.RemoveRange(1, 5)
# range removed
? o1.Content()
#--> sectionlibrary testno extensionFindDuplicates
FindDuplicates -- positions of duplicated chars in the content. A char is "duplicated" if it appears more than once anywhere. Returns the 2nd+ occurrence positions (so the FIRST occurrence is not reported, matching stzList.FindDuplicates semantics).
also written: DuplicationsZ · DuplicateCharsZcomposed example
o1 = new stzString("banana split")
? @@( o1.FindDuplicates() )
#--> [ 4, 5, 6 ]composed from the signature, run for this page QCSXTZZZIBWUSame as FindDupSecutiveCharsCS: ENGINE-BACKED (StzEngineStringFindDupSecutiveCharsCS): positions of each char equal to the one before it. Retires the O(len) CharAt loop. pCaseSensitive=0 compares case-insensitively (per-codepoint casefold).
3 examples runalso written: DupSecutiveCharsZoA = new stzString("a")
s = new stzString( oA.Repeated(1000) )
# ConsecutiveSubStrings count is 375,250
? len(s.ConsecutiveSubStrings())
# FindDupSecutiveChars is 999 (positions 2..1000)
? len(s.FindDupSecutiveChars())
#--> 375250
#--> 999library testQCSXTZZZIBWUSame as FindDupSecutiveSubStringCS: FindDupSecutiveSubString: positions where the substring at i+1 equals the substring of the same length ending at i (i.e. back-to-back identical substrings). Returns the start positions of the second copy in each consecutive pair. ENGINE-BACKED (StzEngineStringFindDupSecutiveSubStringCS): start of the second copy in each back-to-back identical-substring pair. Retires the O(len) Haro while-loop (2 EngineSlice round-trips per step). pCaseSensitive=0 compares the substrings case-insensitively.
1 examples runcomposed example
o1 = new stzString("banana split")
? @@( o1.FindDupSecutiveSubString("an") )
#--> [ 4 ]composed from the signature, run for this page QCSXTZZZIBWUDupSecutiveSubStringZ
DupSecutiveSubStringZ(sub): the substring grouped with the positions of its consecutive-duplicate occurrences.
composed example
o1 = new stzString("banana split")
? @@( o1.DupSecutiveSubStringZ("an") )
#--> [ "an", [ 4 ] ]composed from the signature, run for this page QCSXTZZZIBWUDupSecutiveSubStrings
The plural family: every substring that occurs duplicated back-to-back somewhere in the string (derived, per the original monolith, from the consecutive-duplicate items of the phase-tiled ConsecutiveSubStrings() list), with the positions/sections of the duplicate occurrences. NOTE (engine backlog): O(n^2) Haro-side enumeration -- move the window scan + dup detection engine-side.
composed example
o1 = new stzString("banana split")
? @@( o1.DupSecutiveSubStrings() )
#--> [ "na", "an" ]composed from the signature, run for this page QCSXTZZZIBWUFindDupSecutiveSubStrings
(no comment in the source: the name reads as a sentence) find dup secutive sub stringsin the section find first starting atcomposed example
o1 = new stzString("banana split")
? @@( o1.FindDupSecutiveSubStrings() )
#--> [ 5, 4 ]composed from the signature, run for this page QCSXTZZZIBWU RemoveDupSecutiveSubStrings
(no comment in the source: the name reads as a sentence) remove dup secutive sub stringsin the section find first starting atcomposed example
o1 = new stzString("banana split")
o1.RemoveDupSecutiveSubStrings()
? o1.Content()
#--> ban splitcomposed from the signature, run for this page QCSXTZZZIBWU DupSecutiveSubStringsRemoved
(no comment in the source: the name reads as a sentence) dup secutive sub strings removedin the section find first starting atcomposed example
o1 = new stzString("banana split")
? o1.DupSecutiveSubStringsRemoved()
#--> ban splitcomposed from the signature, run for this page no extension FindBetween
FindBetween(pcSub, pcOpen, pcClose): the positions of pcSub when it appears between pcOpen .. pcClose bounded sections. Convenience wrapper over FindSubStringBoundedBy. FindBetween(sub, open, close): every occurrence of sub ANYWHERE INSIDE a bounded region (containment -- unlike FindSubStringBoundedBy, which requires sub to BE the region).QCSXTZZZIBWU
ContainsAt(p1, p2): does the content contain p2 at position p1? Two shapes supported by narratives: ContainsAt(nPos, pcSub) ContainsAt(pcSub, :Position = nPos) ContainsAt(anPositions, pcSub) -- ContainsAtPositions
3 examples runalso written: ContainsAtPositions# hearts sit at 2, 5, 8
? Q("^♥^^♥^^♥^").ContainsAtPositions([ 2, 5, 8 ], "♥")
# a heart sits at position 1
? Q("♥^^♥^^♥").ContainsAtPosition("♥", 1)
#--> 1
#--> 1library testno extension(no comment in the source: the name reads as a sentence) contains at position 1 examples runin the section find first starting at# hearts sit at 2, 5, 8
? Q("^♥^^♥^^♥^").ContainsAtPositions([ 2, 5, 8 ], "♥")
# a heart sits at position 1
? Q("♥^^♥^^♥").ContainsAtPosition("♥", 1)
#--> 1
#--> 1library testno extension Letters
Letters() / LettersQ(): characters that are letters. Engine- backed: filters the codepoint list by IsLetter() (Unicode-aware).
composed example
o1 = new stzString("banana split")
? @@( o1.Letters() )
#--> [ "b", "a", "n", "a", "n", "a", "s", "p", "l", "i", "t" ]composed from the signature, run for this page QCSXTZZZIBWUNumberOfLetters
(no comment in the source: the name reads as a sentence) number of lettersin the section find first starting atcomposed example
o1 = new stzString("banana split")
? o1.NumberOfLetters()
#--> 11composed from the signature, run for this page no extension Interpolated
FindWXT: predicate-driven find positions; @char binding. (FindWXT removed -- FindW is the single engine-backed form; it accepts the expressive { } / Q(@char).Method() predicates with no eval. See FindW/FindWCS.) Interpolated(paBindings): replace each `${key}` placeholder in This with the corresponding value from paBindings (a hashlist of [:key, value] pairs).QCSXTZZZIBWU
AllCharsAre(pcKind): every char matches the given predicate (which is a symbolic kind like :Chars, :Numbers, :Letters, :Punctuations, :Arabic, :RightToLeft, :Invertible). Engine-backed where the helper exists; falls back to isalpha / isDigit otherwise.
3 examples run# the plural kind
? Q("①②③").AllCharsAre(:CircledNumbers)
# the XT list of kinds
? Q("①②③").AllCharsAreXT([:CircledNumber, :Chars], [])
#--> 1
#--> 1library testQCSXTZZZIBWUIsPluralOfAStzType: predicate checking a :stz<Type>s symbolic name (e.g. :stzListsOfStrings, :stzStrings). Used by narratives that introspect Softanza type symbols.
1 examples runalso written: IsPluralOfStzType# stzchars is a plural of a stz type
? Q("stzchars").IsPluralOfAStzType()
# ... specifically of stzchar
? Q("stzchars").IsPluralOfThisStzType("stzchar")
#--> 1
#--> 1library testno extensionAllCharsAreEven
AllCharsAre extension: :Even / :Odd / :Positive for digits. Augment the existing kind list via inline checks.
composed example
o1 = new stzString("banana split")
? o1.AllCharsAreEven()
#--> 0composed from the signature, run for this page no extensionAllCharsAreOdd
(no comment in the source: the name reads as a sentence) all chars are oddin the section find first starting atcomposed example
o1 = new stzString("banana split")
? o1.AllCharsAreOdd()
#--> 0composed from the signature, run for this page no extension AllCharsArePositive
(no comment in the source: the name reads as a sentence) all chars are positivein the section find first starting atcomposed example
o1 = new stzString("banana split")
? o1.AllCharsArePositive()
#--> 0composed from the signature, run for this page no extension IsNotEqualTo
TRUE if the content differs from the given string. (case-sensitive by default)
composed example
o1 = new stzString("banana split")
? o1.IsNotEqualTo("an")
#--> 1composed from the signature, run for this page QCSXTZZZIBWUIsLessThan
TRUE if the string sorts BEFORE the given one.
composed example
o1 = new stzString("banana split")
? o1.IsLessThan("an")
#--> 0composed from the signature, run for this page no extensionIsGreaterThan
TRUE if the string sorts AFTER the given one.
composed example
o1 = new stzString("banana split")
? o1.IsGreaterThan("an")
#--> 1composed from the signature, run for this page no extensionLevenshteinDistanceWith
The Levenshtein edit distance to the given string.
also written: EditDistanceWithcomposed example
o1 = new stzString("banana split")
? o1.LevenshteinDistanceWith("an")
#--> 10composed from the signature, run for this page no extensionCommonPrefixWith
Same as CommonPrefixWithCS: common prefix / suffixQCSXTZZZIBWU
CommonSuffixWith
Same as CommonSuffixWithCS: common prefix / suffixQCSXTZZZIBWU
DiffWith
The differences between the string and the given one.
composed example
o1 = new stzString("banana split")
? @@( o1.DiffWith("an") )
#--> [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 ]composed from the signature, run for this page no extensionJaroSimilarityWith
jaro / jaro-winkler similarity
composed example
o1 = new stzString("banana split")
? o1.JaroSimilarityWith("an")
#--> 722composed from the signature, run for this page no extensionJaroWinklerSimilarityWith
jaro / jaro-winkler similarity
composed example
o1 = new stzString("banana split")
? o1.JaroWinklerSimilarityWith("an")
#--> 722composed from the signature, run for this page no extensionSoundex
The Soundex phonetic code of the string.
composed example
o1 = new stzString("banana split")
? o1.Soundex()
#--> B521composed from the signature, run for this page no extensionThe (dominant) script of the string.
2 examples run# Inherited
? StzStringQ(" 4 " + ArabicDhammah() + " ").Script()
#--> inheritedlibrary testno extensionScripts
The scripts used in the string.
composed example
o1 = new stzString("banana split")
? @@( o1.Scripts() )
#--> [ "latin", "common" ]composed from the signature, run for this page no extensionNumberOfScripts
How many scripts the string uses.
composed example
o1 = new stzString("banana split")
? o1.NumberOfScripts()
#--> 2composed from the signature, run for this page no extensionIsScriptOfText
callable on the stzString that TQ()/StzTextQ()/QQ() return)
composed example
o1 = new stzString("banana split")
? o1.IsScriptOfText("an")
#--> 0composed from the signature, run for this page no extensionIsLatinScript
TRUE if the string is written in the Latin script.
composed example
o1 = new stzString("banana split")
? o1.IsLatinScript()
#--> 1composed from the signature, run for this page no extensionIsArabicScript
TRUE if the string is written in the Arabic script.
also written: IsArabiccomposed example
o1 = new stzString("banana split")
? o1.IsArabicScript()
#--> 0composed from the signature, run for this page no extensionIsHanScript
TRUE if the string is written in the Han script.
composed example
o1 = new stzString("banana split")
? o1.IsHanScript()
#--> 0composed from the signature, run for this page no extensionIsHybridScript
TRUE if the string mixes several scripts.
composed example
o1 = new stzString("banana split")
? o1.IsHybridScript()
#--> 0composed from the signature, run for this page no extensionIsCommonScript
TRUE if the chars belong to the Common script.
composed example
o1 = new stzString("banana split")
? o1.IsCommonScript()
#--> 0composed from the signature, run for this page no extensionIsInheritedScript
TRUE if the chars belong to the Inherited script.
composed example
o1 = new stzString("banana split")
? o1.IsInheritedScript()
#--> 0composed from the signature, run for this page no extensionNthWord
The nth word of the text.
composed example
o1 = new stzString("banana split")
? o1.NthWord(2)
#--> splitcomposed from the signature, run for this page no extensionFirstWord
The first word of the string.
composed example
o1 = new stzString("banana split")
? o1.FirstWord()
#--> bananacomposed from the signature, run for this page no extensionLastWord
The last word of the string.
composed example
o1 = new stzString("banana split")
? o1.LastWord()
#--> splitcomposed from the signature, run for this page no extensionUniqueWords
Same as UniqueWordsCS: The unique words of the string.
composed example
o1 = new stzString("banana split")
? @@( o1.UniqueWords() )
#--> [ "banana", "split" ]composed from the signature, run for this page QCSXTZZZIBWUContainsWord
Same as ContainsWordCS: TRUE if the string contains the given WORD (word-boundary aware).
composed example
o1 = new stzString("banana split")
? o1.ContainsWord("an")
#--> 0composed from the signature, run for this page QCSXTZZZIBWUReverseWords
Reverse the ORDER of the words in place (mutating).
composed example
o1 = new stzString("banana split")
o1.ReverseWords()
? o1.Content()
#--> split bananacomposed from the signature, run for this page no extensionSortWords
Same as SortWordsCS: Sort the words in place (mutating).QCSXTZZZIBWU
WordFrequency
Each word paired with its frequency.
composed example
o1 = new stzString("banana split")
? o1.WordFrequency("an")
#--> 0composed from the signature, run for this page no extensionMostFrequentWord
The word that occurs most often in the string.
composed example
o1 = new stzString("banana split")
? o1.MostFrequentWord()
#--> bananacomposed from the signature, run for this page no extensionMostFrequentWords
The top-N most frequent words as [[word, count], ...] (count desc). ENGINE-DIRECT one-pass word frequency -- the classic text-analytics workload (search indexing, tag clouds, NLP) that was O(unique x length).
composed example
o1 = new stzString("banana split")
? @@( o1.MostFrequentWords(2) )
#--> [ [ "banana", 1 ], [ "split", 1 ] ]composed from the signature, run for this page no extensionWordsAndTheirCounts
[[word, count], ...] for every distinct word (first-appearance order).
composed example
o1 = new stzString("banana split")
? @@( o1.WordsAndTheirCounts() )
#--> [ [ "banana", 1 ], [ "split", 1 ] ]composed from the signature, run for this page no extensionCharsAndTheirCounts
Same as CharsAndTheirCountsCS: [[char, count], ...] for every distinct character (first-appearance order).
composed example
o1 = new stzString("banana split")
? @@( o1.CharsAndTheirCounts() )
#--> [ [ "b", 1 ], [ "a", 3 ], [ "n", 2 ], [ " ", 1 ], [ "s", 1 ], [ "p", 1 ], [ "l", 1 ], [ "i", 1 ], [ "t", 1 ] ]composed from the signature, run for this page QCSXTZZZIBWUMostFrequentChars
Same as MostFrequentCharsCS: The top-N most frequent characters as [[char, count], ...] (count desc).
composed example
o1 = new stzString("banana split")
? @@( o1.MostFrequentChars(2) )
#--> [ [ "a", 3 ], [ "n", 2 ] ]composed from the signature, run for this page QCSXTZZZIBWUMostFrequentChar
The char that occurs most often in the string.
composed example
o1 = new stzString("banana split")
? o1.MostFrequentChar()
#--> acomposed from the signature, run for this page no extensionNGramsAndTheirCounts
Same as NGramsAndTheirCountsCS: Sequences of n consecutive words (n=2 bigrams, 3 trigrams). Language modeling, autocomplete, collocation detection, plagiarism. [[ngram, count], ...] for every distinct n-gram (first-appearance order).
composed example
o1 = new stzString("banana split")
? @@( o1.NGramsAndTheirCounts(2) )
#--> [ [ "banana split", 1 ] ]composed from the signature, run for this page QCSXTZZZIBWUMostFrequentNGrams
Same as MostFrequentNGramsCS: The top-N most frequent n-grams as [[ngram, count], ...] (count desc).
composed example
o1 = new stzString("banana split")
? @@( o1.MostFrequentNGrams(2, 5) )
#--> [ [ "banana split", 1 ] ]composed from the signature, run for this page QCSXTZZZIBWUCollocations
Same as CollocationsCS: Word pairs that co-occur far more than chance ("machine learning", "New York"). nMinCount filters rare pairs. Returns top-N phrases by PMI.QCSXTZZZIBWU
MostSignificantCollocations
Same as CollocationsCS: Word pairs that co-occur far more than chance ("machine learning", "New York"). nMinCount filters rare pairs. Returns top-N phrases by PMI.
composed example
o1 = new stzString("banana split")
? @@( o1.MostSignificantCollocations(2) )
#--> [ "banana split" ]composed from the signature, run for this page no extensionCosineSimilarityWith
Same as CosineSimilarityWithCS: Bag-of-words cosine between this text and another: 1.0 = same term distribution, 0.0 = nothing shared. Plagiarism, near-duplicate, "find similar". (For corpus TF-IDF weighting see StzTFIDFKeywords.)
also written: SimilarityWithcomposed example
o1 = new stzString("banana split")
? o1.CosineSimilarityWith("an")
#--> 0composed from the signature, run for this page QCSXTZZZIBWUAverageWordsPerSentence
Sentence = text up to each . ! ? terminator. All engine-direct, no materialization: averages come from cached engine counts; the extremes from one segmenting pass.
composed example
o1 = new stzString("banana split")
? o1.AverageWordsPerSentence()
#--> 2composed from the signature, run for this page no extensionAverageCharsPerSentence
The average number of chars per sentence.
composed example
o1 = new stzString("banana split")
? o1.AverageCharsPerSentence()
#--> 12composed from the signature, run for this page no extensionLongestSentenceInWords
The word count of the longest sentence.
composed example
o1 = new stzString("banana split")
? o1.LongestSentenceInWords()
#--> 2composed from the signature, run for this page no extensionShortestSentenceInWords
The word count of the shortest sentence.
composed example
o1 = new stzString("banana split")
? o1.ShortestSentenceInWords()
#--> 2composed from the signature, run for this page no extensionHow many sentences the string holds.
1 examples runcomposed example
o1 = new stzString("banana split")
? o1.NumberOfSentences()
#--> 1composed from the signature, run for this page no extensionUAX#29 sentence segmentation (engine-backed), aligned with NumberOfSentences() -- correctly keeps "Dr. Smith", "3.14", "U.S.A." as one sentence rather than splitting on every '.'. Bulk native-list bridge (O(n)).
2 examples runcomposed example
o1 = new stzString("banana split")
? @@( o1.Sentences() )
#--> [ "banana split" ]composed from the signature, run for this page QCSXTZZZIBWUQQQQQFirstSentence
The first sentence of the string.no extension
LastSentence
The last sentence of the string.no extension
NumberOfParagraphs
How many paragraphs the string holds.
composed example
o1 = new stzString("banana split")
? o1.NumberOfParagraphs()
#--> 1composed from the signature, run for this page no extensionParagraphs
The paragraphs of the string, as a list.
composed example
o1 = new stzString("banana split")
? @@( o1.Paragraphs() )
#--> [ "banana split" ]composed from the signature, run for this page no extensionNthParagraph
The nth paragraph of the string.no extension
Collapse the whitespace runs to single spaces (mutating).
2 examples runo1 = new stzString(" lots of whitespace ")
# edges trimmed
? o1.Trimmed()
# then squeezed and shouted
? o1.SimplifyQ().Uppercased()
#--> lots of whitespace
#--> LOTS OF WHITESPACElibrary testQCSXTZZZIBWUExceptA copy with the whitespace collapsed to single spaces; the original is unchanged.
2 examples run? StzStringQ("ab [] cd").Simplified()
? Q(list2code([ "a", [ [] ], "b" ])).Simplified()
#--> ab [] cd
#--> [ "a", [ [ ] ], "b" ]library testno extensionToSlug
The string turned into a URL slug (lowercase, hyphens).
composed example
o1 = new stzString("banana split")
? o1.ToSlug()
#--> banana-splitcomposed from the signature, run for this page no extensionInitials
The initial letter of each word.
composed example
o1 = new stzString("banana split")
? o1.Initials()
#--> bscomposed from the signature, run for this page no extensionToHex
The string's bytes in hexadecimal form.
composed example
o1 = new stzString("banana split")
? o1.ToHex()
#--> 62616e616e612073706c6974composed from the signature, run for this page no extensionFromHex
Set the content from its hex form (mutating).no extension
UrlEncoded
The string URL-encoded.no extension
UrlEncode
URL-encode the content in place (mutating).QCSXTZZZIBWU
UrlDecoded
The string URL-decoded.no extension
UrlDecode
URL-decode the content in place (mutating).QCSXTZZZIBWU
HtmlEncoded
The string with the HTML-special chars encoded as entities. Engine-backed. This built a per-character LIST of the whole string and concatenated onto a growing result -- the wrap-to-scan shape, quadratic in the string length. The engine does the same five substitutions (& < > " and ' -> ') in one pass, and the bridge now sizes its buffer to fit rather than silently returning "" past 64 KB.no extension
HtmlEncode
HTML-encode the content in place (mutating).no extension
HtmlDecoded
The engine makes ONE left-to-right pass, consuming each entity whole and advancing past it, so a decoded '&' can never re-trigger a match. It also covers ' and numeric entities (&#NN; / &#xHH;), which the five-replace version silently left intact -- a widening, not a behaviour change for anything the old code handled.no extension
HtmlDecode
HTML-decode the content in place (mutating).no extension
ToBinary
The string's bytes in binary form.
composed example
o1 = new stzString("banana split")
? o1.ToBinary()
#--> 01100010 01100001 01101110 01100001 01101110 01100001 00100000 01110011 01110000 01101100 01101001 01110100composed from the signature, run for this page no extensionToOctal
The string's bytes in octal form.
composed example
o1 = new stzString("banana split")
? o1.ToOctal()
#--> 142 141 156 141 156 141 040 163 160 154 151 164composed from the signature, run for this page no extensionEscapedForRegex
The string with the regex special chars escaped. One engine pass. This used to build a per-character LIST of the whole string (@oString.Chars()) and scan the metacharacter set for each one, which allocates a Haro object per character to answer a question about 14 ASCII bytes. Same set, same result.no extension
EscapeForRegex
Escape the regex special chars in place (mutating).no extension
NormalizeNFC
Normalize the content to Unicode NFC in place (mutating).no extension
NormalizedNFC
The string in Unicode NFC normal form.no extension
NormalizeNFD
Normalize the content to Unicode NFD in place (mutating).no extension
NormalizedNFD
The string in Unicode NFD normal form.no extension
NormalizeNFKC
Normalize the content to Unicode NFKC in place (mutating).no extension
NormalizedNFKC
The string in Unicode NFKC normal form.no extension
NormalizeNFKD
Normalize the content to Unicode NFKD in place (mutating).no extension
NormalizedNFKD
The string in Unicode NFKD normal form.no extension
The string in Title Case (each word capitalized).
1 examples run# lowercased
? Q("tunis").Lowercased()
# uppercased
? Q("tunis").Uppercased()
# titlecased
? Q("tunis").Titlecased()
#--> tunis
#--> TUNIS
#--> Tunislibrary testno extensionApplyTitlecase
Titlecase the content in place (mutating).QCSXTZZZIBWU
CaseFolded
The string case-folded (aggressive lowercasing, for caseless comparison).no extension
LeftAlignXT
Same as AlignXT: Align the content in a field of nWidth chars, padded with cFillChar, to the given direction (mutating).no extension
RightAlignXT
Same as AlignXT: Align the content in a field of nWidth chars, padded with cFillChar, to the given direction (mutating).no extension
CenterAlignXT
Same as AlignXT: Align the content in a field of nWidth chars, padded with cFillChar, to the given direction (mutating).no extension
LeftAligned
A copy aligned LEFT in a field of nWidth chars.no extension
RightAligned
A copy aligned RIGHT in a field of nWidth chars.no extension
CenterAligned
A copy CENTERED in a field of nWidth chars.no extension
PadLeft
Same as AlignXT: Align the content in a field of nWidth chars, padded with cFillChar, to the given direction (mutating).no extension
PadRight
Same as AlignXT: Align the content in a field of nWidth chars, padded with cFillChar, to the given direction (mutating).no extension
PaddedLeft
A copy padded on the left to nWidth with the given char.also named: pad on the left right-align fill to width left-padno extension
PaddedRight
A copy padded on the right to nWidth with the given char.no extension
Same as RepeatedLeadingCharsCS: Repeated*Chars return the run as a LIST of chars ([] when there is no run); the *SubString twins give it as a string.
1 examples runo1 = new stzString("exeeeeeTUNIS")
# no repeated leading char
? o1.RepeatedLeadingChar()
# empty list
? len( o1.RepeatedLeadingChars() )
#--> 0library testQCSXTZZZIBWURepeatedTrailingChars
Same as RepeatedTrailingCharsCS: The trailing repeated-char run, as a list (case dial).QCSXTZZZIBWU
Same as RemoveRepeatedLeadingCharsCS: ensure prefix / suffix
1 examples runcomposed example
o1 = new stzString("banana split")
o1.RemoveRepeatedLeadingChars()
? o1.Content()
#--> anana splitcomposed from the signature, run for this page QCSXTZZZIBWUSame as RemoveRepeatedTrailingCharsCS: ensure prefix / suffix
1 examples runcomposed example
o1 = new stzString("banana split")
o1.RemoveRepeatedTrailingChars()
? o1.Content()
#--> banana splicomposed from the signature, run for this page QCSXTZZZIBWUEnsurePrefix
Same as EnsurePrefixCS: ensure prefix / suffixQCSXTZZZIBWU
EnsureSuffix
Same as EnsureSuffixCS: ensure prefix / suffixQCSXTZZZIBWU
Same as RemoveFromStartCS: removing from start / end
2 examples runQCSXTZZZIBWURemove pcSuffix from the end of the string when it ends with it (mutating).
2 examples runo1 = new stzString("programming*")
o1.RemoveFromEnd("*")
# bare word
? o1.Content()
#--> programminglibrary testQCSXTZZZIBWURemovedFromEnd
Same as RemovedFromEndCS: Immutable / past-tense companions: return the modified content without mutating This. Used by stzNumber.RoundTo() and similar fluent chains that want the result as a value.QCSXTZZZIBWU
NthLine
The nth line of the string.no extension
FirstLine
Same as NthLine: The nth line of the string.no extension
LastLine
The last line of the string.no extension
UniqueLines
Same as UniqueLinesCS: The unique lines of the string.
composed example
o1 = new stzString("banana split")
? @@( o1.UniqueLines() )
#--> [ "banana split" ]composed from the signature, run for this page QCSXTZZZIBWUSortLines
Same as SortLinesCS: Sort the lines in place (mutating).QCSXTZZZIBWU
RemoveBlankLines
Remove the blank lines (mutating).no extension
LinesContaining
Same as LinesContainingCS: The lines containing the given substring.
composed example
o1 = new stzString("banana split")
? @@( o1.LinesContaining("an") )
#--> [ "banana split" ]composed from the signature, run for this page QCSXTZZZIBWUSame as TrimCharCS: trimming a specific char
1 examples runo1 = new stzString("♥♥♥123♥♥♥")
o1.TrimChar("♥")
# bare digits
? o1.Content()
#--> 123library testQCSXTZZZIBWUTrimLeftChar
Same as TrimLeftCharCS: Trim the run of the given char from the START (mutating).QCSXTZZZIBWU
TrimRightChar
Same as TrimRightCharCS: Trim the run of the given char from the END (mutating).QCSXTZZZIBWU
IsNeither
Same as IsNeitherCS: IsNeither: TRUE when this string equals neither argument (the -- :Nor named-param spells the second). Restored from the monolith.
composed example
o1 = new stzString("banana split")
? o1.IsNeither("an", "an")
#--> 1composed from the signature, run for this page QCSXTZZZIBWURemoveAnyCharFromLeft/Right: strip the whole leading/trailing run -- of a given char (aliases of RemoveCharFromLeft/Right).
1 examples runno extensionSame as RemoveCharFromRight: Drop the trailing chars matching pcChar from the end of the string (mutating).
1 examples runno extensionEach Softanza class overrides StzType() to report its own type -- (the base stzObject returns :stzObject). Restored for stzString.
4 examples run? Q("ABC") * 3
? ( Q("ABC") * Q(3) ).StzType() + NL
? ( Q("ABC") * Q(3) ).Lowercased()
? Q("ABC") * " -> "
? ( Q("ABC") * Q(" -> ") ).Lowercased()
#--> ABCABCABC
#--> stzstring
#--> abcabcabc
#--> A -> B -> C ->
#--> ...library testno extensionIsLanguageIdentifier
Locale identifier predicates (thin OR-combinators over the existing -- name/abbreviation/number locale checks). Used by stzList's -- IsLocaleList / IsMultilingualString.
composed example
o1 = new stzString("banana split")
? o1.IsLanguageIdentifier()
#--> 0composed from the signature, run for this page no extensionIsScriptIdentifier
TRUE if the string identifies a script (number, code or abbreviation).
composed example
o1 = new stzString("banana split")
? o1.IsScriptIdentifier()
#--> 0composed from the signature, run for this page no extensionIsCountryIdentifier
TRUE if the string identifies a country (number, code, name...).
composed example
o1 = new stzString("banana split")
? o1.IsCountryIdentifier()
#--> 0composed from the signature, run for this page no extensionIsLanguageNameOrAbbreviation
TRUE if the string is a language name or abbreviation.
composed example
o1 = new stzString("banana split")
? o1.IsLanguageNameOrAbbreviation()
#--> 0composed from the signature, run for this page no extension