Softanza
DémarrerEnglish
Softanza
Référence · Données et langage de base

Chaînes de caractères

977 fonctions dans 43 classes, groupées par ce qu'elles font, chacune avec l'explication que la bibliothèque donne d'elle-même.

Le récit de ce domaine, pour un lecteur général : ce qu'un artisan en fait, un exemple exécuté et ses couloirs notés, est sur sa page de la Plateforme.

Les fonctions, par ce qu'elles font

Tester et vérifier

  • 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. dans stzString
    ? Q("(,,)").Check(:That = 'StzCharQ(@Char).IsPunctuation()')
    #--> 1
    test de la bibliothèque
  • IsWord TRUE if the string is a single word. dans stzString
    exemple composé
    o1 = new stzString("banana split")
    ? o1.IsWord()
    #--> 0
    composé à partir de la signature, exécuté pour cette page
  • HasMark control / mark checks dans stzString
    exemple composé
    o1 = new stzString("banana split")
    ? o1.HasMark()
    #--> 0
    composé à partir de la signature, exécuté pour cette page
  • IsAChar TRUE if the string is exactly one char long. dans stzString
    exemple composé
    o1 = new stzString("banana split")
    ? o1.IsChar()
    #--> 0
    composé à partir de la signature, exécuté pour cette page · écrit IsAChar() dans la bibliothèque aujourd'hui : le langage hôte tient déjà IsChar(), et Haro supprime le détour
  • IsBlank TRUE if the string is empty or whitespace only. dans stzString
    exemple composé
    o1 = new stzString("banana split")
    ? o1.IsBlank()
    #--> 0
    composé à partir de la signature, exécuté pour cette page
  • IsEmpty Whether the string has no characters. dans stzString
    exemple composé
    o1 = new stzString("banana split")
    ? o1.IsEmpty()
    #--> 0
    composé à partir de la signature, exécuté pour cette page
  • IsLatin IsLatin(): TRUE iff every char is ASCII-Latin. dans stzString
    # Latin script
    ? StzStringQ("Ⅱ").IsLatin()
    # and a Roman number
    ? StzCharQ("Ⅱ").IsRomanNumber()
    #--> 1
    #--> 1
    test de la bibliothèque
  • 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()`. dans stzString
    exemple composé
    o1 = new stzString("banana split")
    ? o1.IsVowel()
    #--> 0
    composé à partir de la signature, exécuté pour cette page
  • Contains Whether the string contains the given substring. dans stzString
    oS = new stzString("tea rice tea fish")
    ? oS.Contains("tea")
    ? oS.NumberOfOccurrence("tea")
    ? @@( oS.FindAll("tea") )
    #--> 1
    #--> 2
    #--> [ 1, 10 ]
    test de la bibliothèque
  • IsAClass IsAClass(): TRUE if content is a Haro class name (lookup via Haro's classes() introspection). dans stzString
    # stzLen is a function
    ? Q("stzLen").IsFunction()
    # stzChar is a class
    ? Q("stzChar").IsClass()
    #--> 1
    #--> 1
    test de la bibliothèque · écrit IsAClass() dans la bibliothèque aujourd'hui : le langage hôte tient déjà IsClass(), et Haro supprime le détour; écrit IsAFunction() dans la bibliothèque aujourd'hui : le langage hôte tient déjà IsFunction(), et Haro supprime le détour
  • IsADigit TRUE if the string is a single digit. dans stzString
    exemple composé
    o1 = new stzString("banana split")
    ? o1.IsDigit()
    #--> 0
    composé à partir de la signature, exécuté pour cette page · écrit IsADigit() dans la bibliothèque aujourd'hui : le langage hôte tient déjà IsDigit(), et Haro supprime le détour
  • IsEither IsEither(a, :Or = b): TRUE when the content equals either value (string-side override; unwraps the :Or named param). dans stzString
    exemple composé
    o1 = new stzString("banana split")
    ? o1.IsEither(3, 4)
    #--> 0
    composé à partir de la signature, exécuté pour cette page

et 376 autres dans la référence

Trouver

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

et 132 autres dans la référence

Compter et mesurer

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

et 59 autres dans la référence

Remplacer et modifier

  • Update updating the string content dans stzString
    exemple composé
    o1 = new stzString("banana split")
    o1.Update("AN")
    ? o1.Content()
    #--> AN
    composé à partir de la signature, exécuté pour cette page
  • Replace Replace every occurrence of a substring with another. dans stzString
    o1 = new stzString("R I N G")
    o1.Replace(" ", "-")
    # Replace() mutates the object
    ? o1.Content()
    #--> R-I-N-G
    test de la bibliothèque
  • 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. dans stzString
    exemple composé
    o1 = new stzString("banana split")
    o1.ReplaceAt(2, "an", "AN")
    ? o1.Content()
    #--> bANana split
    composé à partir de la signature, exécuté pour cette page
  • UpdateWith UpdateWith(pcNew): replace content with pcNew. Alias of Update. dans stzString
    o1 = new stzString("999999999999")
    o1.UpdateWith("999 999 999.999")
    # the content becomes the new value
    ? o1.Content()
    #--> 999 999 999.999
    test de la bibliothèque
  • ReplaceCharAt ReplaceCharAt(:Position = n, :By = pcNew) -- named-param variant of ReplaceAt for char-at-position replacement. dans stzString
    o1 = new stzString("ABC*EF")
    o1.ReplaceCharAt(:Position = 4, :By = "D")
    # the star became D
    ? o1.Content()
    #--> ABCDEF
    test de la bibliothèque
  • ReplaceCharsW ReplaceCharsWXT(pcCondition, pcNewChar): replace every char matching the predicate with pcNewChar. Engine-backed walk. dans stzString
    exemple composé
    o1 = new stzString("banana split")
    o1.ReplaceCharsW("@char = 'a'", "AN")
    ? o1.Content()
    #--> bANnANnAN split
    composé à partir de la signature, exécuté pour cette 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). dans stzString
    exemple composé
    o1 = new stzString("banana split")
    o1.ReplaceBetween("an", "an", "AN")
    ? o1.Content()
    #--> banANana split
    composé à partir de la signature, exécuté pour cette 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. dans stzString
    o1 = new stzString("123--67--")
    o1.ReplaceSection(1, 3, "~")
    # collapsed
    ? o1.Content()
    #--> ~--67--
    test de la bibliothèque
  • ReplaceAllChars ReplaceAllChars(pcOld, pcNew): char-by-char map. ReplaceAllChars: (:With = pcNew) : replace every char with pcNew Two-arg (pcOld, pcNew) form lives in ReplaceAllCharsXT. dans stzString
    o1 = new stzString("Use these two letters: س and ص.")
    o1.ReplaceAllChars( :With = "*" )
    # as many stars as chars
    ? o1.Content()
    #--> *******************************
    test de la bibliothèque
  • ReplaceNthCharQ ReplaceNthCharQ alias. Replace the char at position n with the given one (chainable). dans stzString
    # positional
    ? StzStringQ("évènement").ReplaceNthCharQ(3, "*").Content()
    # named
    ? StzStringQ("évènement").ReplaceNthCharQ(3, :With = "*").Content()
    #--> év*nement
    #--> év*nement
    test de la bibliothèque
  • ReplaceWithMany Replace the occurrences of pcSub cycling through the given replacements (same as ReplaceByMany). dans stzString
    o1 = new stzString("--Ring--Softanza--")
    o1.ReplaceWithMany("--", [ "1", "2", "3" ])
    # the three '--' get 1, 2, 3
    ? o1.Content()
    #--> 1Ring2Softanza3
    test de la bibliothèque
  • 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 dans 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
    test de la bibliothèque

et 55 autres dans la référence

Retirer

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

et 79 autres dans la référence

Ajouter

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

et 21 autres dans la référence

Découper et extraire

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

et 75 autres dans la référence

Ordonner et déplacer

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

et 6 autres dans la référence

Convertir

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

et 19 autres dans la référence

Afficher, dessiner et mettre en forme

  • Boxed A boxed copy of the string; the original is unchanged. dans stzString
    exemple composé
    o1 = new stzString("banana split")
    ? o1.Boxed()
    #--> ┌──────────────┐
    #--> │ banana split │
    #--> └──────────────┘
    composé à partir de la signature, exécuté pour cette page
  • BoxedRound A rounded-corner boxed copy of the string. dans stzString
    exemple composé
    o1 = new stzString("banana split")
    ? o1.BoxedRound()
    #--> ╭──────────────╮
    #--> │ banana split │
    #--> ╰──────────────╯
    composé à partir de la signature, exécuté pour cette page
  • BoxedRoundedDashed A rounded, dashed-line boxed copy of the string. dans stzString
    exemple composé
    o1 = new stzString("banana split")
    ? o1.BoxedRoundedDashed()
    #--> ╭╌╌╌╌╌╌╌╌╌╌╌╌╌╌╮
    #--> ┊ banana split ┊
    #--> ╰╌╌╌╌╌╌╌╌╌╌╌╌╌╌╯
    composé à partir de la signature, exécuté pour cette page
  • BoxDash misc. dans stzStringCharList
    exemple composé
    o1 = new stzStringCharList("hello")
    ? o1.BoxDash()
    #--> ┌╌╌╌┬╌╌╌┬╌╌╌┬╌╌╌┬╌╌╌┐
    #--> ┊ h ┊ e ┊ l ┊ l ┊ o ┊
    #--> └╌╌╌┴╌╌╌┴╌╌╌┴╌╌╌┴╌╌╌┘
    composé à partir de la signature, exécuté pour cette page
  • BoxedRounded boxed dans stzStringVisualizer
    exemple composé
    o1 = new stzStringVisualizer("hello")
    ? o1.BoxedRounded()
    #--> .-------.
    #--> | hello |
    #--> .-------.
    composé à partir de la signature, exécuté pour cette page
  • BoxedChars boxed chars -- each char in its own cell dans stzStringBoxed
    exemple composé
    o1 = new stzStringBoxed("hello")
    ? o1.BoxedChars()
    #--> ╭────┬────┬────┬────┬────╮
    #--> │ h │ e │ l │ l │ o │
    #--> ╰────┴────┴────┴────┴────╯
    composé à partir de la signature, exécuté pour cette page
  • Box Surround the content with the Softanza box in place (mutating). For a copy, use Boxed. dans 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()`. dans stzString
  • AlignXT Align the content in a field of nWidth chars, padded with cFillChar, to the given direction (mutating). dans stzString
  • BoxRound Box the content with rounded corners in place (mutating). dans stzString
  • BoxEachChar Box each char in its own cell, in place (mutating). dans stzString
  • BoxRoundEachChar BoxRoundEachChar: surround each char with a rounded-corner box. dans stzString

et 8 autres dans la référence

Lire et écrire

Parcourir et appliquer

  • WalkUntil Walk the chars forward: the position where the condition first holds. dans stzString
    exemple composé
    o1 = new stzString("banana split")
    ? o1.WalkUntil("@char = 'a'")
    #--> 1
    composé à partir de la signature, exécuté pour cette 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. dans 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" ]
    test de la bibliothèque
  • WalkForwardW Walk forward collecting where the W condition holds (mirror of WalkBackwardW). dans stzString
    exemple composé
    o1 = new stzString("banana split")
    ? @@( o1.WalkForwardW("@char = 'a'", 2) )
    #--> [ 2, 4, 6 ]
    composé à partir de la signature, exécuté pour cette page
  • EachCharBoxed Each char in its own box cell, as a string. dans stzString
    exemple composé
    o1 = new stzString("banana split")
    ? o1.EachCharBoxed()
    #--> ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┐
    #--> │ b │ a │ n │ a │ n │ a │   │ s │ p │ l │ i │ t │
    #--> └───┴───┴───┴───┴───┴───┴───┴───┴───┴───┴───┴───┘
    composé à partir de la signature, exécuté pour cette 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). dans stzString
    exemple composé
    o1 = new stzString("banana split")
    ? @@( o1.WalkBackwardW("@char = 'a'", 2) )
    #--> [ 6, 4, 2 ]
    composé à partir de la signature, exécuté pour cette page
  • EachCharBoxedDashed Each char in its own dashed box cell. dans stzString
    exemple composé
    o1 = new stzString("banana split")
    ? o1.EachCharBoxedDashed()
    #--> ┌╌╌╌┬╌╌╌┬╌╌╌┬╌╌╌┬╌╌╌┬╌╌╌┬╌╌╌┬╌╌╌┬╌╌╌┬╌╌╌┬╌╌╌┬╌╌╌┐
    #--> ┊ b ┊ a ┊ n ┊ a ┊ n ┊ a ┊   ┊ s ┊ p ┊ l ┊ i ┊ t ┊
    #--> └╌╌╌┴╌╌╌┴╌╌╌┴╌╌╌┴╌╌╌┴╌╌╌┴╌╌╌┴╌╌╌┴╌╌╌┴╌╌╌┴╌╌╌┴╌╌╌┘
    composé à partir de la signature, exécuté pour cette page
  • EachCharBoxedRounded Each char in its own rounded box cell. dans stzString
    exemple composé
    o1 = new stzString("banana split")
    ? o1.EachCharBoxedRounded()
    #--> ╭───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───╮
    #--> │ b │ a │ n │ a │ n │ a │   │ s │ p │ l │ i │ t │
    #--> ╰───┴───┴───┴───┴───┴───┴───┴───┴───┴───┴───┴───╯
    composé à partir de la signature, exécuté pour cette page
  • EachWordReversed Each word with its chars reversed, as a copy. dans stzStringText
    exemple composé
    o1 = new stzStringText("The quick brown fox. It jumps!")
    ? o1.EachWordReversed()
    #--> ehT kciuq nworb .xof tI !spmuj
    composé à partir de la signature, exécuté pour cette 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. dans stzStringList
    exemple composé
    o1 = new stzStringList([ "tea", "rice", "fish" ])
    ? @@( o1.Yield("@item > 3") )
    #--> [ 0, 0, 0 ]
    composé à partir de la signature, exécuté pour cette page
  • Filter filter -- strings containing a substring dans stzStringList
    exemple composé
    o1 = new stzStringList([ "tea", "rice", "fish" ])
    ? @@( o1.Filter("a") )
    #--> [ "tea" ]
    composé à partir de la signature, exécuté pour cette page
  • FilterByEndsWith filter by starts-with / ends-with dans stzStringList
    exemple composé
    o1 = new stzStringList([ "tea", "rice", "fish" ])
    ? @@( o1.FilterByEndsWith("a") )
    #--> [ "tea" ]
    composé à partir de la signature, exécuté pour cette page
  • EachWordCapitalized capitalize each word dans stzStringCaseChanger
    exemple composé
    o1 = new stzStringCaseChanger("hello world foo")
    ? o1.EachWordCapitalized()
    #--> Hello World Foo
    composé à partir de la signature, exécuté pour cette page

et 13 autres dans la référence

Les explications sont celles que la bibliothèque donne d'elle-même, en anglais, lues dans ses commentaires de documentation le 2026-10-01 04:14, from the library at commit 0e72e2e2c, by the library's own stzSelfDoc over 635 class sources.

Les classes de ce domaine

Les narrations sur ce domaine