Softanza
StartFrançais
Softanza
Reference · Core data & language

String

977 functions in 43 classes, grouped by what they do, each with the explanation the library gives of itself.

The story of this area, for a general reader: what a crafter does with it, an example run and its rated lanes, is on its Platform page.

The functions, by what they do

Testing and checking

  • Check Check([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. in stzString
    ? Q("(,,)").Check(:That = 'StzCharQ(@Char).IsPunctuation()')
    #--> 1
    library test
  • IsWord TRUE if the string is a single word. in stzString
    composed example
    o1 = new stzString("banana split")
    ? o1.IsWord()
    #--> 0
    composed from the signature, run for this page
  • HasMark control / mark checks in stzString
    composed example
    o1 = new stzString("banana split")
    ? o1.HasMark()
    #--> 0
    composed from the signature, run for this page
  • IsAChar TRUE if the string is exactly one char long. in stzString
    composed example
    o1 = new stzString("banana split")
    ? o1.IsChar()
    #--> 0
    composed from the signature, run for this page · written IsAChar() in the library today: the host language already holds IsChar(), and Haro removes the detour
  • IsBlank TRUE if the string is empty or whitespace only. in stzString
    composed example
    o1 = new stzString("banana split")
    ? o1.IsBlank()
    #--> 0
    composed from the signature, run for this page
  • IsEmpty Whether the string has no characters. in stzString
    composed example
    o1 = new stzString("banana split")
    ? o1.IsEmpty()
    #--> 0
    composed from the signature, run for this page
  • IsLatin IsLatin(): TRUE iff every char is ASCII-Latin. in stzString
    # Latin script
    ? StzStringQ("Ⅱ").IsLatin()
    # and a Roman number
    ? StzCharQ("Ⅱ").IsRomanNumber()
    #--> 1
    #--> 1
    library test
  • 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()`. in stzString
    composed example
    o1 = new stzString("banana split")
    ? o1.IsVowel()
    #--> 0
    composed from the signature, run for this page
  • Contains Whether the string contains the given substring. in stzString
    oS = new stzString("tea rice tea fish")
    ? oS.Contains("tea")
    ? oS.NumberOfOccurrence("tea")
    ? @@( oS.FindAll("tea") )
    #--> 1
    #--> 2
    #--> [ 1, 10 ]
    library test
  • IsAClass IsAClass(): TRUE if content is a Haro class name (lookup via Haro's classes() introspection). in stzString
    # stzLen is a function
    ? Q("stzLen").IsFunction()
    # stzChar is a class
    ? Q("stzChar").IsClass()
    #--> 1
    #--> 1
    library 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 detour
  • IsADigit TRUE if the string is a single digit. in stzString
    composed example
    o1 = new stzString("banana split")
    ? o1.IsDigit()
    #--> 0
    composed from the signature, run for this page · written IsADigit() in the library today: the host language already holds IsDigit(), and Haro removes the detour
  • IsEither IsEither(a, :Or = b): TRUE when the content equals either value (string-side override; unwraps the :Or named param). in stzString
    composed example
    o1 = new stzString("banana split")
    ? o1.IsEither(3, 4)
    #--> 0
    composed from the signature, run for this page

and 376 more in the reference

Finding

  • Nth Nth(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). in stzString
    composed example
    o1 = new stzString("banana split")
    ? o1.Nth(2, "an")
    #--> 4
    composed from the signature, run for this page
  • Find Find pcSubStr in the string: the positions of EVERY occurrence, as a list (engine-backed, codepoint-aware). (case-sensitive by default) in stzString
    oS = new stzString("tea rice tea fish")
    ? oS.Contains("tea")
    ? oS.NumberOfOccurrence("tea")
    ? @@( oS.FindAll("tea") )
    #--> 1
    #--> 2
    #--> [ 1, 10 ]
    library test
  • LastZ The last char along with its position. in stzString
    composed example
    o1 = new stzString("banana split")
    ? @@( o1.LastZ() )
    #--> [ 12, 12 ]
    composed from the signature, run for this page
  • FirstZ FirstZ(sub) -- the Z grouping [sub, position] of the first occurrence (0-arg keeps the first-char section form). in stzString
    composed example
    o1 = new stzString("banana split")
    ? @@( o1.FirstZ("an") )
    #--> [ "an", 2 ]
    composed from the signature, run for this page
  • NthStz 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 in stzString
    composed example
    o1 = new stzString("banana split")
    ? @@( o1.NthStz(2, "an", 2) )
    #--> [ "an", 4 ]
    composed from the signature, run for this page
  • FindNth find all / find nth in stzString
    composed example
    o1 = new stzString("banana split")
    ? o1.FindNth(2, "an")
    #--> 4
    composed from the signature, run for this page
  • FindSSZ Section-bounded find: the positions of pcSub within n1..n2. in stzString
    composed example
    o1 = new stzString("banana split")
    ? @@( o1.FindSSZ("an", 2, 5) )
    #--> [ 2, 4 ]
    composed from the signature, run for this page
  • LastStz The last occurrence: the substring paired with its position, from the given start position (an empty list when there is no match). in stzString
    composed example
    o1 = new stzString("banana split")
    ? @@( o1.LastStz("an", 2) )
    #--> [ "an", 4 ]
    composed from the signature, run for this page
  • NthChar The char at position n (codepoint-aware). in stzString
    composed example
    o1 = new stzString("banana split")
    ? o1.NthChar(2)
    #--> a
    composed from the signature, run for this page
  • 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.) in stzString
    composed example
    o1 = new stzString("banana split")
    ? o1.NthStzS(2, "an", 2)
    #--> 4
    composed from the signature, run for this page
  • NthWord The nth word of the text. in stzString
    composed example
    o1 = new stzString("banana split")
    ? o1.NthWord(2)
    #--> split
    composed from the signature, run for this page
  • FindLast The last occurrence of the substring: the position(s). in stzString
    o1 = new stzString("•♥••••♥••")
    # FindLast('♥') is 7
    ? o1.FindLast("♥")
    # FindLast('_') (absent) is 0
    ? o1.FindLast("_")
    #--> 7
    #--> 0
    library test

and 132 more in the reference

Counting and measuring

  • HowMany HowMany family: count occurrences of pcSub in the content. in stzString
    composed example
    o1 = new stzString("banana split")
    ? o1.HowMany("an")
    #--> 2
    composed from the signature, run for this page
  • CountRegex How many matches of the given regex pattern. in stzString
    composed example
    o1 = new stzString("banana split")
    ? o1.CountRegex("an")
    #--> 2
    composed from the signature, run for this page
  • NumberForm NumberForm(): :Integer, :Decimal, :Hex, :Binary, or :Other. in stzString
    composed example
    o1 = new stzString("banana split")
    ? o1.NumberForm()
    #--> other
    composed from the signature, run for this page
  • CountCharsW How many chars satisfy the W condition. in stzString
    # 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
    #--> 4
    library test
  • SizeInBytes The size of the string in bytes (UTF-8). in stzString
    o1 = new stzString("s㊱m")
    ? o1.NumberOfBytes()
    ? o1.SizeInBytes()
    ? @@(o1.Bytes())
    ? @@(o1.NumberOfBytesPerChar())
    #--> 5
    #--> 5
    #--> [ "s", "�", "�", "�", "m" ]
    #--> [ [ "s", 1 ], [ "㊱", 3 ], [ "m", 1 ] ]
    library test
  • SumOfNumbers Data extraction: total amounts in an invoice/log, averages, ranges. A number = optional '-', digits, one optional '.' with more digits. in stzString
    composed example
    o1 = new stzString("banana split")
    ? o1.SumOfNumbers()
    #--> 0
    composed from the signature, run for this page
  • NumberOfBytes The size of the string in bytes (UTF-8). in stzString
    o1 = new stzString("s㊱m")
    ? o1.NumberOfBytes()
    ? o1.SizeInBytes()
    ? @@(o1.Bytes())
    ? @@(o1.NumberOfBytesPerChar())
    #--> 5
    #--> 5
    #--> [ "s", "�", "�", "�", "m" ]
    #--> [ [ "s", 1 ], [ "㊱", 3 ], [ "m", 1 ] ]
    library test
  • NumberOfChars The length of the string in characters (Unicode codepoints). in stzString
    ostr = new stzString("s㊱m")
    ? ostr.NumberOfChars()
    ? ostr[2]
    #--> 3
    #--> ㊱
    library test
  • NumberOfLines How many lines the string holds. in stzString
    composed example
    o1 = new stzString("banana split")
    ? o1.NumberOfLines()
    #--> 1
    composed from the signature, run for this page
  • NumberOfWords How many words the string holds. in stzString
    o1 = new stzString("the bread was cold and the tea was cold")
    ? o1.NumberOfWords()
    #--> 9
    library test
  • CountInSections How many occurrences of pcSub fall inside the given sections. in stzString
    composed example
    o1 = new stzString("banana split")
    ? o1.CountInSections("an", [ "an", "a" ])
    #--> 0
    composed from the signature, run for this page
  • 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. in stzString
    composed example
    o1 = new stzString("banana split")
    ? o1.CountSubStrings("an")
    #--> 2
    composed from the signature, run for this page

and 59 more in the reference

Replacing and setting

  • Update updating the string content in stzString
    composed example
    o1 = new stzString("banana split")
    o1.Update("AN")
    ? o1.Content()
    #--> AN
    composed from the signature, run for this page
  • Replace Replace every occurrence of a substring with another. in stzString
    o1 = new stzString("R I N G")
    o1.Replace(" ", "-")
    # Replace() mutates the object
    ? o1.Content()
    #--> R-I-N-G
    library test
  • ReplaceAt 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. in stzString
    composed example
    o1 = new stzString("banana split")
    o1.ReplaceAt(2, "an", "AN")
    ? o1.Content()
    #--> bANana split
    composed from the signature, run for this page
  • UpdateWith UpdateWith(pcNew): replace content with pcNew. Alias of Update. in stzString
    o1 = new stzString("999999999999")
    o1.UpdateWith("999 999 999.999")
    # the content becomes the new value
    ? o1.Content()
    #--> 999 999 999.999
    library test
  • ReplaceCharAt ReplaceCharAt(:Position = n, :By = pcNew) -- named-param variant of ReplaceAt for char-at-position replacement. in stzString
    o1 = new stzString("ABC*EF")
    o1.ReplaceCharAt(:Position = 4, :By = "D")
    # the star became D
    ? o1.Content()
    #--> ABCDEF
    library test
  • ReplaceCharsW ReplaceCharsWXT(pcCondition, pcNewChar): replace every char matching the predicate with pcNewChar. Engine-backed walk. in stzString
    composed example
    o1 = new stzString("banana split")
    o1.ReplaceCharsW("@char = 'a'", "AN")
    ? o1.Content()
    #--> bANnANnAN split
    composed from the signature, run for this page
  • ReplaceBetween Engine replaces INCLUDING bounds. For default (bounds preserved), we wrap replacement with pcOpen + replacement + pcClose. IB variants pass replacement directly (engine includes bounds). in stzString
    composed example
    o1 = new stzString("banana split")
    o1.ReplaceBetween("an", "an", "AN")
    ? o1.Content()
    #--> banANana split
    composed from the signature, run for this page
  • ReplaceSection Replace 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. in stzString
    o1 = new stzString("123--67--")
    o1.ReplaceSection(1, 3, "~")
    # collapsed
    ? o1.Content()
    #--> ~--67--
    library test
  • ReplaceAllChars ReplaceAllChars(pcOld, pcNew): char-by-char map. ReplaceAllChars: (:With = pcNew) : replace every char with pcNew Two-arg (pcOld, pcNew) form lives in ReplaceAllCharsXT. in stzString
    o1 = new stzString("Use these two letters: س and ص.")
    o1.ReplaceAllChars( :With = "*" )
    # as many stars as chars
    ? o1.Content()
    #--> *******************************
    library test
  • ReplaceNthCharQ ReplaceNthCharQ alias. Replace the char at position n with the given one (chainable). in stzString
    # positional
    ? StzStringQ("évènement").ReplaceNthCharQ(3, "*").Content()
    # named
    ? StzStringQ("évènement").ReplaceNthCharQ(3, :With = "*").Content()
    #--> év*nement
    #--> év*nement
    library test
  • ReplaceWithMany Replace the occurrences of pcSub cycling through the given replacements (same as ReplaceByMany). in stzString
    o1 = new stzString("--Ring--Softanza--")
    o1.ReplaceWithMany("--", [ "1", "2", "3" ])
    # the three '--' get 1, 2, 3
    ? o1.Content()
    #--> 1Ring2Softanza3
    library test
  • ReplaceInSection ReplaceInSection: 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 in stzString
    # 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 Heart
    library test

and 55 more in the reference

Removing

  • Trim Remove leading and trailing whitespace in place (mutating). For a copy, use Trimmed. in stzString
    o1 = new stzString(" ♥♥♥123♥♥♥   ")
    o1.Trim()
    # only the spaces went
    ? o1.Content()
    #--> ♥♥♥123♥♥♥
    library test
  • Remove Remove every occurrence of pcSubStr from the string (mutating). For a copy, use Removed. in stzString
    composed example
    o1 = new stzString("banana split")
    o1.Remove("an")
    ? o1.Content()
    #--> ba split
    composed from the signature, run for this page
  • RemoveAt RemoveAt -- two shapes: RemoveAt(n) -- remove single char at position n RemoveAt(n, pcSub) -- remove pcSub at position n in stzString
    composed example
    o1 = new stzString("banana split")
    o1.RemoveAt(2, "an")
    ? o1.Content()
    #--> bana split
    composed from the signature, run for this page
  • RemoveChar Remove every occurrence of the given char (mutating). in stzString
    composed example
    o1 = new stzString("banana split")
    o1.RemoveChar(2)
    ? o1.Content()
    #--> bnana split
    composed from the signature, run for this page
  • RemoveRange Remove nRange chars starting at nStart (mutating). in stzString
    o1 = new stzString("extrasection")
    o1.RemoveRange(1, 5)
    # range removed
    ? o1.Content()
    #--> section
    library test
  • RemoveBounds Single-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. in stzString
    composed example
    o1 = new stzString("banana split")
    o1.RemoveBounds()
    ? o1.Content()
    #--> anana spli
    composed from the signature, run for this page
  • RemoveCharsW RemoveCharsWXT(pcCondition): remove every char where the predicate is TRUE. Predicate runs with @char bound. in stzString
    composed example
    o1 = new stzString("banana split")
    o1.RemoveCharsW("@char = 'a'")
    ? o1.Content()
    #--> bnn split
    composed from the signature, run for this page
  • RemoveSpaces Remove all the spaces (mutating). in stzString
    composed example
    o1 = new stzString("banana split")
    o1.RemoveSpaces()
    ? o1.Content()
    #--> bananasplit
    composed from the signature, run for this page
  • RemoveBetween Remove what lies between every pcOpen...pcClose pair (the bounds stay) -- mutating. in stzString
    o1 = new stzString("__/♥\__")
    o1.RemoveBetween("/", "\")
    # the heart between / and \\ is gone, bounds kept
    ? o1.Content()
    #--> __/\__
    library test
  • RemoveFromEnd Remove pcSuffix from the end of the string when it ends with it (mutating). in stzString
    o1 = new stzString("programming*")
    o1.RemoveFromEnd("*")
    # bare word
    ? o1.Content()
    #--> programming
    library test
  • RemoveNthChar 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. in stzString
    o1 = new stzString("125.450")
    o1.RemoveNthChar(7)
    # the 7th char is gone
    ? o1.Content()
    #--> 125.45
    library test
  • RemoveSection Remove the chars at positions n1..n2 (mutating). in stzString
    o1 = new stzString("ABC456DE")
    o1.RemoveSection(4, 6)
    # the digits vanish
    ? o1.Content()
    #--> ABCDE
    library test

and 79 more in the reference

Adding

  • AddXT AddXT(cBoth, :Around = "p") Shortcut for [cBoth, cBoth] -- same separator on both sides. in stzString
    o1 = new stzString("__♥__♥__♥__")
    o1.AddXT(" ", :AroundEach = "♥")
    # every heart breathes
    ? o1.Content()
    #--> __ ♥ __ ♥ __ ♥ __
    library test
  • Extend Extend / ExtendXT: append content / pad to length / pad to position. Port from archive line 3596 (the DSL variant) plus the simpler positional cases. in stzString
    composed example
    o1 = new stzString("banana split")
    o1.Extend("x")
    ? o1.Content()
    #--> banana splitx
    composed from the signature, run for this page
  • Insert Insert(pcSub, :BeforePosition = n / :AfterPosition = n / n). in stzString
    composed example
    o1 = new stzString("banana split")
    o1.Insert("an", 2)
    ? o1.Content()
    #--> bananana split
    composed from the signature, run for this page
  • ExtendTo Pad the string to length n with spaces (mutating). in stzString
    o1 = new stzString("ABC")
    o1.ExtendTo(5)
    # it is padded to width 5 with spaces
    ? o1.Content()
    #--> ABC
    library test
  • AddBounds AddBounds([pcOpen, pcClose]): wrap content with bounds. 1-arg list form accepted: AddBounds(["<<", ">>"]). in stzString
    o1 = new stzString("word")
    o1.AddBounds(["<<",">>"])
    # bounded
    ? o1.Content()
    #--> <<word>>
    library test
  • InsertAfter Insert pcSubStr AFTER position n -- or after the given anchor substring (mutating). in stzString
    composed example
    o1 = new stzString("banana split")
    o1.InsertAfter(2, "an")
    ? o1.Content()
    #--> baannana split
    composed from the signature, run for this page
  • ExtendToWith ExtendToWith(n, pcChar): pad the string out to total length n by appending copies of pcChar at the end. in stzString
    o1 = new stzString("ABC")
    o1.ExtendToWith(5, "*")
    # 'ABC' padded to width 5 with '*'
    ? o1.Content()
    #--> ABC**
    library test
  • InsertBefore Insert pcSubStr BEFORE position n -- or before the given anchor substring (mutating). in stzString
    o1 = new stzString("123456789")
    o1.InsertBefore([4, 7], "_")
    # underscores land before positions 4 and 7
    ? o1.Content()
    #--> 123_456_789
    library test
  • ExtendToNChars ExtendToNChars(n): pad content with spaces up to length n. in stzString
    o1 = new stzString("ABC")
    o1.ExtendToNChars(5)
    # 'ABC' padded to width 5
    ? o1.Content()
    #--> ABC
    library test
  • InsertSubStrings InsertSubStrings(anPos, pacStr): insert pacStr[i] at anPos[i], processed from highest position down so earlier positions stay valid. in stzString
    o1 = 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 test
  • ExtendToWithCharsIn Pad the string to total length n by cycling the given chars or range (mutating). in stzString
    o1 = new stzString("123")
    o1.ExtendToWithCharsIn( 8, "1":"3" )
    # it grows to length 8 by cycling 1,2,3
    ? o1.Content()
    #--> 12312312
    library test
  • InsertAfterPositions InsertAfterPositions(anPos, pcStr): insert pcStr after each position in anPos. Walk descending so earlier positions stay valid as later inserts shift the string. in stzString
    o1 = new stzString("SOFTANZA")
    o1.InsertAfterPositions([ 2, 4, 6, 8 ], " ")
    # pairs, no trailing space
    ? o1.Content()
    #--> SO FT AN ZA
    library test

and 21 more in the reference

Splitting and extracting

  • Split Split the string into a list of parts around a separator. in stzString
    # 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 test
  • Splits Splits([pcSep]): split-on-separator words; 0-arg uses whitespace. in stzString
    composed example
    o1 = new stzString("banana split")
    ? @@( o1.Splits(" ") )
    #--> [ "banana", "split" ]
    composed from the signature, run for this page
  • Section The substring from position n1 to n2 (inclusive, codepoint-aware). in stzString
    # 456
    ? StzStringQ("123456789").Section(4, 6)
    #--> 456
    library test
  • SplitAt split at -- dispatcher (case-sensitive by default) in stzString
    composed example
    o1 = new stzString("banana split")
    ? @@( o1.SplitAt(" ") )
    #--> [ "banana", "split" ]
    composed from the signature, run for this page
  • PartsUsing The parts of the string partitioned by the given expression's value. in stzString
    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
  • SubStrings ENGINE-BACKED (StzEngineStringSubStrings): all substrings in (i,j) order, no dedup. Retires the O(n^2) Haro double-loop. in stzString
    o1 = new stzString("RINGORIALAND")
    # there are 12*13/2 = 78 substrings
    ? o1.NumberOfSubStrings()
    # SubStrings() returns that many
    ? len( o1.SubStrings() )
    #--> 78
    #--> 78
    library test
  • SubStringXT 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 in stzString
    # the named-param shape is recognised
    ? Q(:IsBoundedBy = ".").IsIsBoundedByNamedParam()
    # the direct check
    ? Q(".♥.").SubStringIsBoundedBy("♥", ".")
    # the SubStringXT spelling
    ? Q(".♥.").SubStringXT("♥", :IsBoundedBy = ".")
    #--> 1
    #--> 1
    #--> 1
    library test
  • SplitByRegex Split the string on the matches of the given regex pattern. in stzString
    composed example
    o1 = new stzString("banana split")
    ? @@( o1.SplitByRegex("an") )
    #--> [ "b", "", "a split" ]
    composed from the signature, run for this page
  • SectionBounds SectionBounds(n1, n2, nLeftMax, nRightMax): the [open, close] bound substrings just before n1 and just after n2. in stzString
    composed example
    o1 = new stzString("banana split")
    ? @@( o1.SectionBounds(2, 5, 2, 2) )
    #--> [ "b", "a " ]
    composed from the signature, run for this page
  • SplitAtCharsW SplitAtCharsW(pcCondition): split content at every char where the predicate is TRUE. Same semantics as SplitW, spelled for char-narratives. in stzString
    # 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 test
  • SplitToNParts 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. in stzString
    composed example
    o1 = new stzString("banana split")
    ? @@( o1.SplitToNParts(2) )
    #--> [ "banana", " split" ]
    composed from the signature, run for this page
  • SplitAtPosition Split the string at the given position. in stzString
    composed example
    o1 = new stzString("banana split")
    ? @@( o1.SplitAtPosition(2) )
    #--> [ "b", "nana split" ]
    composed from the signature, run for this page

and 75 more in the reference

Ordering and moving

  • Move Move(n1, n2): move char from position n1 to position n2. Accepts named-param form Move(:CharFromPosition = N, :To = M). in stzString
    composed example
    o1 = new stzString("banana split")
    o1.Move(2, 5)
    ? o1.Content()
    #--> bnaana split
    composed from the signature, run for this page
  • Sort Sort the CHARS of the string in ascending order in place (mutating). For a copy, use Sorted. in stzString
    composed example
    o1 = new stzString("banana split")
    o1.Sort()
    ? o1.Content()
    #--> aaabilnnpst
    composed from the signature, run for this page
  • Swap Swap(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. in stzString
    o1 = new stzString("TWO, ONE, THREE!")
    o1.Swap("TWO", :And = "ONE")
    # the words traded places
    ? o1.Content()
    #--> ONE, TWO, THREE!
    library test
  • Reverse Reverse the order of the characters in the string, in place (mutating). For a copy that leaves the original unchanged, use Reversed. in stzString
    composed example
    o1 = new stzString("banana split")
    o1.Reverse()
    ? o1.Content()
    #--> tilps ananab
    composed from the signature, run for this page
  • ReverseWords Reverse the ORDER of the words in place (mutating). in stzString
    composed example
    o1 = new stzString("banana split")
    o1.ReverseWords()
    ? o1.Content()
    #--> split banana
    composed from the signature, run for this page
  • SortInAscending Sort the chars in ascending order in place (mutating). in stzString
    composed example
    o1 = new stzString("banana split")
    o1.SortInAscending()
    ? o1.Content()
    #--> aaabilnnpst
    composed from the signature, run for this page
  • SortInDescending Sort the chars of the string in descending order in place (mutating). in stzString
    composed example
    o1 = new stzString("banana split")
    o1.SortInDescending()
    ? o1.Content()
    #--> tspnnlibaaa
    composed from the signature, run for this page
  • SwapWords Exchange the words at the two given word-positions (mutating). in stzStringText
    composed example
    o1 = new stzStringText("The quick brown fox. It jumps!")
    o1.SwapWords(2, 5)
    ? o1.Content()
    #--> The It brown fox. quick jumps!
    composed from the signature, run for this page
  • ReverseEachWord Reverse the CHARS of each word in place (mutating). in stzStringText
    composed example
    o1 = new stzStringText("The quick brown fox. It jumps!")
    o1.ReverseEachWord()
    ? o1.Content()
    #--> ehT kciuq nworb .xof tI !spmuj
    composed from the signature, run for this page
  • SortAsc sort (engine) in stzStringCharList
    composed example
    o1 = new stzStringCharList("hello")
    o1.SortAsc()
    ? @@( o1.Content() )
    #--> [ "ehllo" ]
    composed from the signature, run for this page
  • SortDesc sort (engine) in stzStringCharList
    composed example
    o1 = new stzStringCharList("hello")
    o1.SortDesc()
    ? @@( o1.Content() )
    #--> [ "ollhe" ]
    composed from the signature, run for this page
  • SortLines sort lines in stzStringLines
    composed example
    cDup = "aaa" + NL + "bbb" + NL + "aaa"
    o1 = new stzStringLines(cDup)
    o1.SortLines()
    ? o1.Content()
    #--> aaa
    #--> aaa
    #--> bbb
    composed from the signature, run for this page

and 6 more in the reference

Converting

  • ToHex The string's bytes in hexadecimal form. in stzString
    composed example
    o1 = new stzString("banana split")
    ? o1.ToHex()
    #--> 62616e616e612073706c6974
    composed from the signature, run for this page
  • ToList 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. in stzString
    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
  • ToSlug The string turned into a URL slug (lowercase, hyphens). in stzString
    composed example
    o1 = new stzString("banana split")
    ? o1.ToSlug()
    #--> banana-split
    composed from the signature, run for this page
  • ToOctal The string's bytes in octal form. in stzString
    composed example
    o1 = new stzString("banana split")
    ? o1.ToOctal()
    #--> 142 141 156 141 156 141 040 163 160 154 151 164
    composed from the signature, run for this page
  • ToBinary The string's bytes in binary form. in stzString
    composed example
    o1 = new stzString("banana split")
    ? o1.ToBinary()
    #--> 01100010 01100001 01101110 01100001 01101110 01100001 00100000 01110011 01110000 01101100 01101001 01110100
    composed from the signature, run for this page
  • ToListInString ToListInString(): the hosted list rendered in normal form (@@). in stzString
    composed 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
  • ToListInStringNF The content as a list literal in normal form, as a string. in stzString
    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
  • 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). in stzString
    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
  • ToListInShortForm ToListInShortForm(): render the hosted list in the short range syntax -- "1 : 3" for numbers, '"A" : "D"' for strings. in stzString
    composed example
    o1 = new stzString("banana split")
    ? o1.ToListInShortForm()
    #--> "b" : "t"
    composed from the signature, run for this page
  • ToListInNormalForm ToListInNormalForm(): the hosted list rendered in normal bracketed form (whatever syntax hosted it -- short ranges included). in stzString
    composed example
    o1 = new stzString("banana split")
    ? o1.ToListInNormalForm()
    #--> [ "b", "a", "n", "a", "n", "a", " ", "s", "p", "l", "i", "t" ]
    composed from the signature, run for this page
  • ToString The strings joined with newlines, as one string. in stzStringList
    composed example
    o1 = new stzStringList([ "tea", "rice", "fish" ])
    ? o1.ToString()
    #--> tea
    #--> rice
    #--> fish
    composed from the signature, run for this page
  • ToListOfStzStrings Each string wrapped as a stzString object, as a list. in stzStringList
    composed example
    o1 = new stzStringList([ "tea", "rice", "fish" ])
    ? @@( o1.ToListOfStzStrings() )
    #--> [ @noname, @noname, @noname ]
    composed from the signature, run for this page

and 19 more in the reference

Showing, drawing and formatting

  • Boxed A boxed copy of the string; the original is unchanged. in stzString
    composed example
    o1 = new stzString("banana split")
    ? o1.Boxed()
    #--> ┌──────────────┐
    #--> │ banana split │
    #--> └──────────────┘
    composed from the signature, run for this page
  • BoxedRound A rounded-corner boxed copy of the string. in stzString
    composed example
    o1 = new stzString("banana split")
    ? o1.BoxedRound()
    #--> ╭──────────────╮
    #--> │ banana split │
    #--> ╰──────────────╯
    composed from the signature, run for this page
  • BoxedRoundedDashed A rounded, dashed-line boxed copy of the string. in stzString
    composed example
    o1 = new stzString("banana split")
    ? o1.BoxedRoundedDashed()
    #--> ╭╌╌╌╌╌╌╌╌╌╌╌╌╌╌╮
    #--> ┊ banana split ┊
    #--> ╰╌╌╌╌╌╌╌╌╌╌╌╌╌╌╯
    composed from the signature, run for this page
  • BoxDash misc. in stzStringCharList
    composed example
    o1 = new stzStringCharList("hello")
    ? o1.BoxDash()
    #--> ┌╌╌╌┬╌╌╌┬╌╌╌┬╌╌╌┬╌╌╌┐
    #--> ┊ h ┊ e ┊ l ┊ l ┊ o ┊
    #--> └╌╌╌┴╌╌╌┴╌╌╌┴╌╌╌┴╌╌╌┘
    composed from the signature, run for this page
  • BoxedRounded boxed in stzStringVisualizer
    composed example
    o1 = new stzStringVisualizer("hello")
    ? o1.BoxedRounded()
    #--> .-------.
    #--> | hello |
    #--> .-------.
    composed from the signature, run for this page
  • BoxedChars boxed chars -- each char in its own cell in stzStringBoxed
    composed example
    o1 = new stzStringBoxed("hello")
    ? o1.BoxedChars()
    #--> ╭────┬────┬────┬────┬────╮
    #--> │ h │ e │ l │ l │ o │
    #--> ╰────┴────┴────┴────┴────╯
    composed from the signature, run for this page
  • Box Surround the content with the Softanza box in place (mutating). For a copy, use Boxed. in stzString
  • Show Show -- print the content to stdout (terminated by NL). Convenience alias used by narrative tests of the form `o.Show()` instead of `? o.Content()`. in stzString
  • AlignXT Align the content in a field of nWidth chars, padded with cFillChar, to the given direction (mutating). in stzString
  • BoxRound Box the content with rounded corners in place (mutating). in stzString
  • BoxEachChar Box each char in its own cell, in place (mutating). in stzString
  • BoxRoundEachChar BoxRoundEachChar: surround each char with a rounded-corner box. in stzString

and 8 more in the reference

Reading and writing

Walking and applying

  • WalkUntil Walk the chars forward: the position where the condition first holds. in stzString
    composed example
    o1 = new stzString("banana split")
    ? o1.WalkUntil("@char = 'a'")
    #--> 1
    composed from the signature, run for this page
  • YieldCharsW YieldCharsW(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. in stzString
    # 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 test
  • WalkForwardW Walk forward collecting where the W condition holds (mirror of WalkBackwardW). in stzString
    composed example
    o1 = new stzString("banana split")
    ? @@( o1.WalkForwardW("@char = 'a'", 2) )
    #--> [ 2, 4, 6 ]
    composed from the signature, run for this page
  • EachCharBoxed Each char in its own box cell, as a string. in stzString
    composed 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
  • WalkBackwardW 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). in stzString
    composed example
    o1 = new stzString("banana split")
    ? @@( o1.WalkBackwardW("@char = 'a'", 2) )
    #--> [ 6, 4, 2 ]
    composed from the signature, run for this page
  • EachCharBoxedDashed Each char in its own dashed box cell. in stzString
    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
  • EachCharBoxedRounded Each char in its own rounded box cell. in stzString
    composed 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
  • EachWordReversed Each word with its chars reversed, as a copy. in stzStringText
    composed example
    o1 = new stzStringText("The quick brown fox. It jumps!")
    ? o1.EachWordReversed()
    #--> ehT kciuq nworb .xof tI !spmuj
    composed from the signature, run for this page
  • Yield StringsW above answers WHICH strings matched; this answers what the condition said about each one, so the result lines up with Content() position for position. Same evaluation, two questions. in stzStringList
    composed example
    o1 = new stzStringList([ "tea", "rice", "fish" ])
    ? @@( o1.Yield("@item > 3") )
    #--> [ 0, 0, 0 ]
    composed from the signature, run for this page
  • Filter filter -- strings containing a substring in stzStringList
    composed example
    o1 = new stzStringList([ "tea", "rice", "fish" ])
    ? @@( o1.Filter("a") )
    #--> [ "tea" ]
    composed from the signature, run for this page
  • FilterByEndsWith filter by starts-with / ends-with in stzStringList
    composed example
    o1 = new stzStringList([ "tea", "rice", "fish" ])
    ? @@( o1.FilterByEndsWith("a") )
    #--> [ "tea" ]
    composed from the signature, run for this page
  • EachWordCapitalized capitalize each word in stzStringCaseChanger
    composed example
    o1 = new stzStringCaseChanger("hello world foo")
    ? o1.EachWordCapitalized()
    #--> Hello World Foo
    composed from the signature, run for this page

and 13 more in the reference

The explanations are the ones the library gives of itself, read from its documentation comments on 2026-10-01 04:14, from the library at commit 0e72e2e2c, by the library's own stzSelfDoc over 635 class sources.

The classes of this area

Narrations about this area