Home › Packages › text

Package text

This package contains 11 source unit(s) defining 11 class(es) / struct(s). Each unit below lists its fields (the values it stores) and methods (the actions it performs), with a plain explanation of each.

SLCharset #sleela 2.5 (lib/text/SLCharset.sleela)

SLCharset class

SLCharset -- a comprehensive character-set contract for the text >

Carries the standard Metadata Class record — eleven catalogued provenance attributes (version, id, author, date, copyright, trademark, corporation, origin, birth date, science rating, national schedule) with matching get/set accessors. These are omitted from the tables below for brevity.

Fields — the named values this unit stores.

FieldDeclarationWhat it holds
valueString value = "UTF-8"canonical charset name

Methods — the actions this unit can perform.

MethodSignatureWhat it does
utf8String utf8()---- well-known canonical names (in-language constants) ------------
utf16String utf16()No description in source.
utf16leString utf16le()No description in source.
utf16beString utf16be()No description in source.
utf32String utf32()No description in source.
asciiString ascii()No description in source.
latin1String latin1()No description in source.
setvoid set(String v)---- name management (in-language) ---------------------------------
getString get()No description in source.
clearvoid clear()No description in source.
nameString name()No description in source.
equalsboolean equals(String other)No description in source.
canonicalString canonical(String n)canonical(n): resolve common aliases to a canonical name (real, via ==).
isUnicodeboolean isUnicode()---- classification (in-language) ----------------------------------
isSingleByteboolean isSingleByte()No description in source.
isAsciiCompatboolean isAsciiCompat()No description in source.
bridgeString bridge(String op)---- bridged transcoding (the real byte work) ---------------------
bridgeArgString bridgeArg(String op, String a)No description in source.
encodeString encode(String text)No description in source.
decodeString decode(String bytes)No description in source.
canEncodeString canEncode(String text)No description in source.
newEncoderString newEncoder()No description in source.
newDecoderString newDecoder()No description in source.
typeNameString typeName()---- introspection -------------------------------------------------
availableboolean available()No description in source.
copySLCharset copy()SLCloneable / SLDisposable intent.
disposevoid dispose()No description in source.

SLFormatter #sleela 2.5 (lib/text/SLFormatter.sleela)

SLFormatter class

SLFormatter -- a comprehensive text formatter for the text >

Carries the standard Metadata Class record — eleven catalogued provenance attributes (version, id, author, date, copyright, trademark, corporation, origin, birth date, science rating, national schedule) with matching get/set accessors. These are omitted from the tables below for brevity.

Fields — the named values this unit stores.

FieldDeclarationWhat it holds
valueString value = ""Last pattern set, for stateful callers; the helpers are also stateless.

Methods — the actions this unit can perform.

MethodSignatureWhat it does
setvoid set(String v)No description in source.
getString get()No description in source.
clearvoid clear()No description in source.
render1String render1(String a)---- in-language assembly (real) ---------------------------------- render1..render3: substitute {} placeholders left to right with args, built purely with +. The pattern is split on the literal "{}" marker.
render2String render2(String a, String b)No description in source.
render3String render3(String a, String b, String c)No description in source.
fillString fill(String pattern, String arg)fill(pattern, arg): appends arg to pattern. Finding a "{}" marker inside a raw pattern is char-level work the language cannot do, so fill() is the honest append primitive render1..3 build on; for true positional templating use template() below (caller supplies the literal segments) or the bridged format().
templateString template(String[] segments, String[] args)template(segments, args): REAL positional substitution, fully in-language. The caller supplies the literal pieces already split, so no char search is needed. The result interleaves segments and args: segments = ["Hello, ", "! You have ", " messages."] args = ["Max", "3"] -> "Hello, Max! You have 3 messages." Works for any counts: leftover segments are appended, missing args are treated as "". This is the dependable template engine for the text family.
templateSepString templateSep(String[] args, String sep)templateSep(args, sep): join args with a separator and no literal frame -- a common special case of template(). Real.
wrapString wrap(String prefix, String body, String suffix)prefixSuffix: the dependable in-language form -- caller supplies the parts.
kvString kv(String key, String val)key/value line rendering (real).
kvLineString kvLine(String key, String val)No description in source.
fieldString field(String key, String val, String sep)No description in source.
listString list(String[] parts, String sep)list(parts, sep): render a String[] separated by sep (real).
bulletsString bullets(String[] parts)bullets(parts): render a String[] as a dashed bullet block (real).
numberedString numbered(String[] parts)numbered(parts): render a String[] as a 1-based numbered list (real).
table2String table2(String[] keys, String[] vals)table2(keys, vals): render two parallel String[] as aligned "key: val" lines (real). Uses the shorter of the two lengths.
repeatCharString repeatChar(String padChar, int count)repeatChar(padChar, count): padChar repeated count times (real). The in-language padding primitive. count <= 0 yields "".
padString pad(String s, int count, String padChar)pad / padRight(s, count, padChar): append `count` pad units after s (real). Honest naming: this adds `count` units of padding (it cannot measure s to pad to an absolute column -- that is the bridged padTo()).
padRightString padRight(String s, int count, String padChar)No description in source.
padLeftString padLeft(String s, int count, String padChar)padLeft(s, count, padChar): prepend `count` pad units before s (real).
indentString indent(String block, String padChar, int count)indent(block, padChar, count): prefix with `count` pad units (real).
columnLeftString columnLeft(String[] cells, int width, String padChar)---- real column alignment over a char-cell view ------------------- When the caller supplies the content as a String[] of glyph cells, we know its true character width (arrayLength), so we can align to an ABSOLUTE column fully in-language -- the exact-column case that the raw-String padLeft/padRight could not do and padTo() had to bridge.
columnRightString columnRight(String[] cells, int width, String padChar)No description in source.
columnCenterString columnCenter(String[] cells, int width, String padChar)No description in source.
fromCellsString fromCells(String[] cells)fromCells(cells): rejoin a char-cell array into a String (real).
bridgeString bridge(String op, String a)---- bridged printf-style formatting ------------------------------
bridgeArgString bridgeArg(String op, String a, String b)No description in source.
formatString format(String pattern, String args)format(pattern, args): printf-style, needs spec parsing -> bridged.
formatOneString formatOne(String pattern, String a)No description in source.
padToString padTo(String s, String width)No description in source.
alignRightString alignRight(String s, String width)No description in source.
typeNameString typeName()---- introspection -------------------------------------------------
availableboolean available()No description in source.
copySLFormatter copy()SLCloneable / SLDisposable intent.
disposevoid dispose()No description in source.

SLRegex #sleela 2.5 (lib/text/SLRegex.sleela)

SLRegex class

SLRegex -- a comprehensive regular-expression contract for the >

Carries the standard Metadata Class record — eleven catalogued provenance attributes (version, id, author, date, copyright, trademark, corporation, origin, birth date, science rating, national schedule) with matching get/set accessors. These are omitted from the tables below for brevity.

Fields — the named values this unit stores.

FieldDeclarationWhat it holds
valueString value = ""the pattern source
flagsString flags = ""e.g. "i", "m", "s", "ix"
compiledint compiled = 01 once the runtime has compiled it (via bridge)

Methods — the actions this unit can perform.

MethodSignatureWhat it does
setvoid set(String v)---- pattern management (in-language) ------------------------------
getString get()No description in source.
clearvoid clear()No description in source.
setFlagsvoid setFlags(String f)No description in source.
getFlagsString getFlags()No description in source.
equalsboolean equals(String other)No description in source.
isEmptyboolean isEmpty()No description in source.
anchoredString anchored()Pattern assembly helpers (real, built with +): anchor / group / alternate.
startAnchoredString startAnchored()No description in source.
endAnchoredString endAnchored()No description in source.
groupedString grouped()No description in source.
optionalString optional()No description in source.
alternateString alternate(String other)No description in source.
withFlagsString withFlags()No description in source.
bridgeString bridge(String op)---- bridged matching (the real engine) ----------------------------
bridgeArgString bridgeArg(String op, String a)No description in source.
bridgeArg2String bridgeArg2(String op, String a, String b)No description in source.
compileString compile()No description in source.
isCompiledboolean isCompiled()No description in source.
matchesString matches(String input)No description in source.
findString find(String input)No description in source.
findAllString findAll(String input)No description in source.
groupString group(String input, String idx)No description in source.
groupCountString groupCount()No description in source.
replaceAllString replaceAll(String input, String to)No description in source.
replaceFirstString replaceFirst(String input, String to)No description in source.
splitString split(String input)No description in source.
typeNameString typeName()---- introspection -------------------------------------------------
availableboolean available()No description in source.
copySLRegex copy()SLCloneable / SLDisposable intent.
disposevoid dispose()No description in source.

SLString #sleela 2.5 (lib/text/SLString.sleela)

SLString class

The comprehensive SLeeLa text/String contract (SLString) for the >

Carries the standard Metadata Class record — eleven catalogued provenance attributes (version, id, author, date, copyright, trademark, corporation, origin, birth date, science rating, national schedule) with matching get/set accessors. These are omitted from the tables below for brevity.

Fields — the named values this unit stores.

FieldDeclarationWhat it holds
valueString value = ""---- backing value ------------------------------------------------- The text this SLString wraps. value == "" is the canonical empty state.

Methods — the actions this unit can perform.

MethodSignatureWhat it does
idint id()---- identity ------------------------------------------------------
nameString name()No description in source.
setvoid set(String v)---- construction / lifecycle -------------------------------------- Library convention is an explicit initialiser rather than a constructor.
getString get()No description in source.
clearvoid clear()No description in source.
withSLString with(String v)fluent seed
copySLString copy()SLCloneable intent: a detached copy of this SLString.
disposevoid dispose()SLDisposable intent: release to the canonical empty state.
concatString concat(String other)Concatenation: the one native String operator besides compare.
equalsboolean equals(String other)Equality / emptiness via the native == on strings.
isEmptyboolean isEmpty()No description in source.
notEmptyboolean notEmpty()No description in source.
isNullboolean isNull()Null/absence helpers (a SLeeLa String field may be unset == null).
isBlankLikeboolean isBlankLike()No description in source.
appendSLString append(String tail)Append/prepend mutate the wrapped value and return it fluently.
prependSLString prepend(String head)No description in source.
appendLineSLString appendLine(String tail)No description in source.
repeatString repeat(int n)repeat(n): value repeated n times (n <= 0 yields ""). Built with a loop over the native + operator -- fully in-language.
joinString join(String[] parts, String sep)join(parts, sep): join a String[] with a separator. In-language: loop + +.
joinLinesString joinLines(String[] parts)joinLines(parts): join a String[] with newlines.
surroundString surround(String left, String right)surround / quote: wrap the value with affixes (in-language).
quoteString quote()No description in source.
parensString parens()No description in source.
concatBothString concatBoth(String a, String b)Static-style helpers: the same in-language operations as free functions over explicit arguments, for callers that do not wish to seed value first.
equalsTextboolean equalsText(String a, String b)No description in source.
isEmptyTextboolean isEmptyText(String s)No description in source.
repeatTextString repeatText(String s, int n)No description in source.
repeatWithSepString repeatWithSep(int n, String sep)repeatWithSep(n, sep): the value repeated n times, separated by sep. e.g. value "ab", n 3, sep "," -> "ab,ab,ab". n <= 0 yields "".
timesSLString times(int n)times(n): fluent in-place repeat -- sets value to itself n times.
defaultIfEmptyString defaultIfEmpty(String fallback)defaultIfEmpty / defaultIfBlank: fall back when unset/empty. Real: uses only == against "" and null.
orElseSLString orElse(String fallback)No description in source.
equalsAnyOfboolean equalsAnyOf(String[] options)equalsAnyOf(options): true if value equals any element of the array. Real: native == in a loop.
equalsNoneOfboolean equalsNoneOf(String[] options)equalsNoneOf(options): the complement of equalsAnyOf.
ensureExactString ensureExact(String required)ensurePrefix / ensureSuffix: add an affix only if not already fully equal to being the whole value (in-language: we can test whole-string equality, not substring, so this guards against double-wrapping an exact match).
wrapEachString[] wrapEach(String[] parts, String left, String right)wrapEach(parts, left, right): wrap every element of a String[] and return a new String[] of the same length. Real: array alloc + loop + +.
joinNonEmptyString joinNonEmpty(String[] parts, String sep)joinNonEmpty(parts, sep): join a String[] with sep, skipping null/"" parts. Real: == tests + loop.
countPartsint countParts(String[] parts)countParts(parts): number of non-null, non-empty elements in a String[].
linesString lines(String[] parts)lines(parts) / csv(parts): common joins as named conveniences.
csvString csv(String[] parts)No description in source.
spacedString spaced(String[] parts)No description in source.
concatAllString concatAll(String[] parts)concatAll(parts): concatenate every element of a String[] with no separator (real: loop + +). The separator-less sibling of join.
wrapIfNotEmptyString wrapIfNotEmpty(String left, String right)wrapIfNotEmpty(left, right): surround the value only when it is non-empty; an empty/unset value stays "" (real: == guard). Avoids emitting bare affixes.
prefixIfString prefixIf(boolean cond, String head)prefixIf(cond, head) / suffixIf(cond, tail): conditionally affix the value and return the result (real). Handy when assembling text from flags.
suffixIfString suffixIf(boolean cond, String tail)No description in source.
fromCellsString fromCells(String[] cells)fromCells(cells): rejoin a char-cell array into a String (real).
lengthCellsint lengthCells(String[] cells)lengthCells(cells): real character length of a char-cell view.
charAtCellsString charAtCells(String[] cells, int i)charAtCells(cells, i): the glyph at index i, or "" if out of range (real).
substringCellsString substringCells(String[] cells, int from, int to)substringCells(cells, from, to): the cells in [from, to) rejoined (real). from is clamped to 0, to is clamped to the length; from >= to yields "".
indexOfCellint indexOfCell(String[] cells, String needle)indexOfCell(cells, needle): first index whose cell == needle, else -1 (real).
lastIndexOfCellint lastIndexOfCell(String[] cells, String needle)lastIndexOfCell(cells, needle): last matching index, else -1 (real).
containsCellboolean containsCell(String[] cells, String needle)containsCell(cells, needle): true if any cell equals needle (real).
countCellint countCell(String[] cells, String needle)countCell(cells, needle): how many cells equal needle (real).
startsWithCellsboolean startsWithCells(String[] cells, String[] prefix)startsWithCells(cells, prefix): does the cell view begin with the prefix cell array? Real: element-wise == over the leading cells.
endsWithCellsboolean endsWithCells(String[] cells, String[] suffix)endsWithCells(cells, suffix): does the cell view end with the suffix cells?
reverseCellsString reverseCells(String[] cells)reverseCells(cells): the glyphs in reverse order, rejoined (real).
replaceCellsString[] replaceCells(String[] cells, String from, String to)replaceCells(cells, from, to): every cell equal to `from` becomes `to`; returns a new String[] of the same length (real).
equalsCellsboolean equalsCells(String[] a, String[] b)equalsCells(a, b): element-wise equality of two char-cell views (real).
padCellsLeftString padCellsLeft(String[] cells, int width, String padCell)padCellsLeft / padCellsRight(cells, width, padCell): pad the view to a real target character width with padCell, returning a String (real). If the view is already >= width, it is returned rejoined unchanged.
padCellsRightString padCellsRight(String[] cells, int width, String padCell)No description in source.
padCenterCellsString padCenterCells(String[] cells, int width, String padCell)padCenterCells(cells, width, padCell): centre the view in a real character width, padding both sides with padCell. Any odd remainder goes on the right (matching common centre-text conventions). If the view is already >= width, it is returned rejoined unchanged. Fully in-language (loops + +).
truncateCellsString truncateCells(String[] cells, int width, String ellipsisCell)truncateCells(cells, width, ellipsisCell): if the view is longer than width real characters, keep the first (width - 1) cells and append ellipsisCell so the result is exactly `width` cells wide; otherwise return it unchanged. A width <= 0 yields "". Real: slice + append over the supplied cells.
sliceCellsString[] sliceCells(String[] cells, int from, int to)sliceCells(cells, from, to): the cells in [from, to) as a NEW String[] (real). from is clamped to 0, to to the length; from >= to yields an empty array. This is the array-returning sibling of substringCells (which rejoins).
insertCellsString[] insertCells(String[] cells, int at, String[] ins)insertCells(cells, at, ins): a NEW cell array with the cells of `ins` spliced in before index `at` (at clamped to [0, len]). Real: array alloc + copy loops.
deleteCellsRangeString[] deleteCellsRange(String[] cells, int from, int to)deleteCellsRange(cells, from, to): a NEW cell array with [from, to) removed (from clamped to 0, to to the length; from >= to removes nothing). Real.
matchesAtboolean matchesAt(String[] cells, int at, String[] needle)matchesAt(cells, at, needle): does the needle cell-sequence occur in `cells` starting exactly at index `at`? Real: element-wise == over the window.
indexOfSeqCellsint indexOfSeqCells(String[] cells, String[] needle)indexOfSeqCells(cells, needle): first start index where the needle sequence occurs, or -1. An empty needle matches at 0 (as substring search does). Real.
lastIndexOfSeqCellsint lastIndexOfSeqCells(String[] cells, String[] needle)lastIndexOfSeqCells(cells, needle): last start index of the needle sequence, or -1. Empty needle matches at the end. Real.
containsSeqCellsboolean containsSeqCells(String[] cells, String[] needle)containsSeqCells / startsWithSeqCells / endsWithSeqCells: multi-cell forms of the single-cell predicates, built on matchesAt / indexOfSeqCells (real).
startsWithSeqCellsboolean startsWithSeqCells(String[] cells, String[] needle)No description in source.
endsWithSeqCellsboolean endsWithSeqCells(String[] cells, String[] needle)No description in source.
countSeqCellsint countSeqCells(String[] cells, String[] needle)countSeqCells(cells, needle): number of NON-OVERLAPPING occurrences of the needle sequence. An empty needle yields 0 (no progress possible). Real.
replaceSeqCellsString replaceSeqCells(String[] cells, String[] from, String[] to)replaceSeqCells(cells, from, to): replace every NON-OVERLAPPING occurrence of the `from` cell-sequence with the `to` cell-sequence, returning the rejoined String. An empty `from` returns the view unchanged. Real: scan + rebuild.
splitCellsOnString[] splitCellsOn(String[] cells, String sepCell)splitCellsOn(cells, sepCell): split the view on each cell equal to sepCell, returning the segments as a NEW String[] (each segment is the rejoined run of cells between separators; adjacent separators yield "" segments). Real.
mapCellString mapCell(String cell, String[] fromSet, String[] toSet)mapCell(cell, fromSet, toSet): the mapped cell if `cell` equals some fromSet[k] (first match wins), else `cell` unchanged. Real.
mapCellsString[] mapCells(String[] cells, String[] fromSet, String[] toSet)mapCells(cells, fromSet, toSet): translate every cell through the pair table and return a NEW String[] of the same length (real).
mapCellsToStringString mapCellsToString(String[] cells, String[] fromSet, String[] toSet)mapCellsToString(cells, fromSet, toSet): as mapCells, rejoined to a String.
trimCellsString trimCells(String[] cells, String blankCell)trimCells(cells, blankCell): drop leading and trailing cells equal to blankCell, returning the rejoined inner String (real). All-blank -> "".
bridgeString bridge(String op)Descriptor builders.
bridgeArgString bridgeArg(String op, String a)No description in source.
bridgeArg2String bridgeArg2(String op, String a, String b)No description in source.
bridgeOpString bridgeOp(String[] fields)bridgeOp(fields): read the op name back out of a descriptor that has been split on ":" into fields (field 0 == "text.bridge", field 1 == the op). Real: a caller that split the descriptor (e.g. via the bridged split()) can reason about it fully in-language. Returns "" if the array is malformed.
isBridgeDescriptorboolean isBridgeDescriptor(String[] fields)isBridgeDescriptor(fields): true if the split fields name a text.bridge descriptor for a known op (real; composes bridgeOp + isBridged).
isBridgedboolean isBridged(String op)Descriptor introspection: does this string name a bridged op, and which?
bridgeKindString bridgeKind(String op)bridgeKind(op): "int" / "boolean" / "string" / "string[]" -- the TYPE the runtime yields for a bridged op, so a caller knows how to read the result even though the descriptor itself is carried as a String.
lengthString length()Length / indexing -- bridged (no in-language char access). length() returns the descriptor; lengthValue() signals the int-typed form.
lengthValueString lengthValue()No description in source.
charAtString charAt(String idx)No description in source.
codePointAtString codePointAt(String idx)No description in source.
charsString chars()No description in source.
substringString substring(String from, String to)Slicing / search -- bridged.
indexOfString indexOf(String needle)No description in source.
lastIndexOfString lastIndexOf(String needle)No description in source.
containsString contains(String needle)No description in source.
startsWithString startsWith(String prefix)No description in source.
endsWithString endsWith(String suffix)No description in source.
codePointsString codePoints()Length / indexing (continued) -- bridged.
toUpperCaseString toUpperCase()Transformation -- bridged.
toLowerCaseString toLowerCase()No description in source.
trimString trim()No description in source.
stripString strip()No description in source.
stripLeadingString stripLeading()strip only the leading / trailing run of Unicode whitespace -- char-level, so bridged (the in-language trimCells covers the explicit char-cell case).
stripTrailingString stripTrailing()No description in source.
normalizeString normalize(String form)Unicode normalization (NFC/NFD/NFKC/NFKD named by `form`) -- bridged.
replaceString replace(String from, String to)No description in source.
replaceAllString replaceAll(String regex, String to)No description in source.
replaceFirstString replaceFirst(String regex, String to)replaceFirst: replace only the first regex match -- bridged.
splitString split(String regex)Splitting / matching / ordering / hashing -- bridged.
matchesString matches(String regex)No description in source.
compareToString compareTo(String other)No description in source.
compareToIgnoreCaseString compareToIgnoreCase(String other)No description in source.
equalsIgnoreCaseString equalsIgnoreCase(String other)No description in source.
hashCodeString hashCode()No description in source.
formatString format(String pattern)Formatting -- bridged (format uses the native formatter over the bridge).
formatWithString formatWith(String pattern, String arg)formatWith(pattern, arg): single-argument printf-style format -- bridged.
typeNameString typeName()---- introspection -------------------------------------------------
availableboolean available()No description in source.

SLStringBuffer #sleela 2.5 (lib/text/SLStringBuffer.sleela)

SLStringBuffer class

SLStringBuffer -- the synchronized mutable text buffer for the >

Carries the standard Metadata Class record — eleven catalogued provenance attributes (version, id, author, date, copyright, trademark, corporation, origin, birth date, science rating, national schedule) with matching get/set accessors. These are omitted from the tables below for brevity.

Fields — the named values this unit stores.

FieldDeclarationWhat it holds
valueString value = ""No description in source.
editsint edits = 0number of mutations
locksint locks = 0depth of synchronized sections entered

Methods — the actions this unit can perform.

MethodSignatureWhat it does
beginSyncString beginSync()---- synchronization (bridged runtime concern) -------------------- The native runtime supplies the real monitor; these mark the boundary and keep an honest in-language view of lock depth for diagnostics. (Named beginSync/endSync rather than lock/unlock: lock is a reserved built-in.)
endSyncString endSync()No description in source.
isLockedboolean isLocked()No description in source.
lockDepthint lockDepth()No description in source.
clearvoid clear()---- lifecycle -----------------------------------------------------
isEmptyboolean isEmpty()No description in source.
notEmptyboolean notEmpty()No description in source.
editCountint editCount()No description in source.
appendSLStringBuffer append(String s)---- in-language appends (guarded; fluent) ------------------------
appendIntSLStringBuffer appendInt(int n)No description in source.
appendBoolSLStringBuffer appendBool(boolean b)No description in source.
appendLineSLStringBuffer appendLine(String s)No description in source.
prependSLStringBuffer prepend(String s)No description in source.
repeatSLStringBuffer repeat(String s, int n)No description in source.
appendIfSLStringBuffer appendIf(boolean cond, String s)appendIf(cond, s): guarded conditional append (real, fluent).
joinSLStringBuffer join(String[] parts, String sep)No description in source.
toStringString toString()---- result --------------------------------------------------------
getString get()No description in source.
setvoid set(String v)No description in source.
bridgeString bridge(String op)---- bridged char-level operations ---------------------------------
bridgeArgString bridgeArg(String op, String a)No description in source.
bridgeArg2String bridgeArg2(String op, String a, String b)No description in source.
charAtString charAt(String idx)No description in source.
substringString substring(String from, String to)No description in source.
insertAtString insertAt(String idx, String s)No description in source.
deleteRangeString deleteRange(String from, String to)No description in source.
reverseString reverse()No description in source.
indexOfString indexOf(String needle)No description in source.
typeNameString typeName()---- introspection -------------------------------------------------
availableboolean available()No description in source.
copySLStringBuffer copy()SLCloneable / SLDisposable intent.
disposevoid dispose()No description in source.

SLStringBuilder #sleela 2.5 (lib/text/SLStringBuilder.sleela)

SLStringBuilder class

SLStringBuilder -- a comprehensive mutable text builder for the >

Carries the standard Metadata Class record — eleven catalogued provenance attributes (version, id, author, date, copyright, trademark, corporation, origin, birth date, science rating, national schedule) with matching get/set accessors. These are omitted from the tables below for brevity.

Fields — the named values this unit stores.

FieldDeclarationWhat it holds
valueString value = ""Accumulated text.
segmentsint segments = 0number of segments appended through this builder (real, in-language count). NOT the character length -- character length is char-level and bridged via length()/lengthValue().
editsint edits = 0number of mutations (append/insert/clear...)

Methods — the actions this unit can perform.

MethodSignatureWhat it does
clearvoid clear()---- lifecycle -----------------------------------------------------
isEmptyboolean isEmpty()No description in source.
notEmptyboolean notEmpty()No description in source.
segmentCountint segmentCount()real, in-language: how many segments have been appended.
editCountint editCount()No description in source.
lengthString length()character length is char-level -> bridged, returned as an honest descriptor.
lengthValueString lengthValue()No description in source.
appendSLStringBuilder append(String s)---- in-language appends (return this for fluent chaining) ---------
appendIntSLStringBuilder appendInt(int n)No description in source.
appendBoolSLStringBuilder appendBool(boolean b)No description in source.
appendLineSLStringBuilder appendLine(String s)No description in source.
newlineSLStringBuilder newline()No description in source.
prependSLStringBuilder prepend(String s)No description in source.
spaceSLStringBuilder space()No description in source.
appendIfSLStringBuilder appendIf(boolean cond, String s)appendIf(cond, s): append only when cond is true (real, fluent).
appendJoinedSLStringBuilder appendJoined(String[] parts, String sep)appendJoined(parts, sep): append a String[] joined by sep as one segment.
repeatSLStringBuilder repeat(String s, int n)repeat(s, n): append s n times (n <= 0 is a no-op).
joinSLStringBuilder join(String[] parts, String sep)join(parts, sep): append a String[] joined by sep.
appendAllSLStringBuilder appendAll(String[] parts)appendAll(parts): append every element of a String[].
toStringString toString()---- result --------------------------------------------------------
getString get()No description in source.
setvoid set(String v)No description in source.
appendCellsSLStringBuilder appendCells(String[] cells)---- char-cell view (REAL char-level ops over an explicit String[]) ----- When the caller supplies the glyphs as a String[] of single cells, these are genuinely in-language -- no bridge, no faking. appendCells builds the value from cells; reverseCells/charAtCells operate on a supplied view.
reverseCellsString reverseCells(String[] cells)reverseCells(cells): the glyphs reversed and rejoined (real).
charAtCellsString charAtCells(String[] cells, int i)charAtCells(cells, i): glyph at i, or "" if out of range (real).
lengthCellsint lengthCells(String[] cells)lengthCells(cells): real character length of a char-cell view.
bridgeString bridge(String op)---- bridged char-level operations --------------------------------- Need the raw code units; cross the VM/OS bridge with an honest descriptor.
bridgeArgString bridgeArg(String op, String a)No description in source.
bridgeArg2String bridgeArg2(String op, String a, String b)No description in source.
charLengthString charLength(String s)charLength(s): the exact character length of a string is char-level, so it is bridged and returned as an honest descriptor -- never a faked integer.
charAtString charAt(String idx)No description in source.
substringString substring(String from, String to)No description in source.
insertAtString insertAt(String idx, String s)No description in source.
deleteRangeString deleteRange(String from, String to)No description in source.
reverseString reverse()No description in source.
indexOfString indexOf(String needle)No description in source.
typeNameString typeName()---- introspection -------------------------------------------------
availableboolean available()No description in source.
copySLStringBuilder copy()SLCloneable / SLDisposable intent.
disposevoid dispose()No description in source.

SLStringCells #sleela 2.5 (lib/text/SLStringCells.sleela)

SLStringCells class

SLStringCells -- a pure, static-style companion to SLString that >

Carries the standard Metadata Class record — eleven catalogued provenance attributes (version, id, author, date, copyright, trademark, corporation, origin, birth date, science rating, national schedule) with matching get/set accessors. These are omitted from the tables below for brevity.

Methods — the actions this unit can perform.

MethodSignatureWhat it does
idint id()---- identity ------------------------------------------------------
nameString name()No description in source.
typeNameString typeName()No description in source.
availableboolean available()No description in source.
joinCellsString joinCells(String[] cells)joinCells(cells): rejoin a char-cell array into a String (real).
joinWithString joinWith(String[] cells, String sep)joinWith(cells, sep): rejoin with a separator between cells (real).
copyCellsString[] copyCells(String[] cells)copyCells(cells): a detached copy of the cell array (real).
repeatCellsString[] repeatCells(String[] cells, int n)repeatCells(cells, n): a NEW cell array with the view repeated n times (n <= 0 yields an empty array). Real: array alloc + copy loops.
concatCellsString[] concatCells(String[] a, String[] b)concatCells(a, b): a NEW cell array that is a followed by b (real).
lengthint length(String[] cells)No description in source.
isEmptyboolean isEmpty(String[] cells)No description in source.
atString at(String[] cells, int i)at(cells, i): the glyph at index i, or "" if out of range (real).
firstString first(String[] cells)first / last: the end glyphs, or "" when empty (real).
lastString last(String[] cells)No description in source.
sliceString[] slice(String[] cells, int from, int to)slice(cells, from, to): the cells in [from, to) as a NEW array; from clamped to 0, to to the length; from >= to yields an empty array (real).
substringString substring(String[] cells, int from, int to)substring(cells, from, to): slice(...) rejoined to a String (real).
reverseString[] reverse(String[] cells)reverse(cells): a NEW cell array in reverse order (real).
reverseStringString reverseString(String[] cells)reverseString(cells): the glyphs reversed and rejoined (real).
indexOfint indexOf(String[] cells, String needle)No description in source.
lastIndexOfint lastIndexOf(String[] cells, String needle)No description in source.
containsboolean contains(String[] cells, String needle)No description in source.
countint count(String[] cells, String needle)No description in source.
matchesAtboolean matchesAt(String[] cells, int at, String[] needle)matchesAt(cells, at, needle): does needle occur starting exactly at `at`?
indexOfSeqint indexOfSeq(String[] cells, String[] needle)indexOfSeq(cells, needle): first start index of needle, or -1 (empty needle matches at 0). lastIndexOfSeq is the right-to-left form.
lastIndexOfSeqint lastIndexOfSeq(String[] cells, String[] needle)No description in source.
containsSeqboolean containsSeq(String[] cells, String[] needle)No description in source.
startsWithboolean startsWith(String[] cells, String[] needle)No description in source.
endsWithboolean endsWith(String[] cells, String[] needle)No description in source.
countSeqint countSeq(String[] cells, String[] needle)countSeq(cells, needle): non-overlapping occurrences (empty needle -> 0).
replaceSeqString replaceSeq(String[] cells, String[] from, String[] to)replaceSeq(cells, from, to): every non-overlapping `from` becomes `to`, rejoined to a String (empty `from` returns the view unchanged). Real.
replaceCellString[] replaceCell(String[] cells, String from, String to)replaceCell(cells, from, to): every cell == from becomes to; a NEW array of the same length (real).
insertString[] insert(String[] cells, int at, String[] ins)No description in source.
deleteRangeString[] deleteRange(String[] cells, int from, int to)No description in source.
splitOnString[] splitOn(String[] cells, String sepCell)splitOn(cells, sepCell): split on each cell == sepCell; the segments as a NEW String[] (adjacent separators yield "" segments). Real.
fieldCountint fieldCount(String[] cells, String sepCell)fieldCount(cells, sepCell): number of fields splitOn would produce (real).
mapCellString mapCell(String cell, String[] fromSet, String[] toSet)mapCell(cell, fromSet, toSet): the mapped cell if cell == fromSet[k] (first match wins), else the cell unchanged (real).
mapString[] map(String[] cells, String[] fromSet, String[] toSet)map(cells, fromSet, toSet): translate every cell; a NEW array (real).
mapToStringString mapToString(String[] cells, String[] fromSet, String[] toSet)mapToString(cells, fromSet, toSet): map(...) rejoined to a String (real).
isBlankCellboolean isBlankCell(String cell, String[] blanks)isBlankCell(cell, blanks): true if the cell equals any blank in the set.
trimString trim(String[] cells, String[] blanks)trim(cells, blanks): drop leading + trailing cells in the blank set, rejoined.
isBlankboolean isBlank(String[] cells, String[] blanks)isBlank(cells, blanks): true if the view is empty or all blank cells (real).
padLeftString padLeft(String[] cells, int width, String padCell)No description in source.
padRightString padRight(String[] cells, int width, String padCell)No description in source.
padCenterString padCenter(String[] cells, int width, String padCell)No description in source.
truncateString truncate(String[] cells, int width, String ellipsisCell)truncate(cells, width, ellipsisCell): keep first (width-1) cells + ellipsis when longer than width, so the result is exactly `width` cells; width <= 0 yields "" (real).
equalsboolean equals(String[] a, String[] b)equals(a, b): element-wise equality of two cell views (real).
commonPrefixLengthint commonPrefixLength(String[] a, String[] b)commonPrefixLength(a, b): number of leading cells a and b share (real).
asciiCellsString[] asciiCells()asciiCells(): the 95 printable ASCII glyphs (space..~) as a cell array. The index of a cell is its ASCII code minus 32, so this doubles as a code table.
asciiCodeint asciiCode(String cell)asciiCode(cell): the ASCII code (32..126) of a single printable cell, or -1 if it is not a known printable ASCII glyph (real: lookup in asciiCells).
asciiUpperSetString[] asciiUpperSet()asciiUpper / asciiLower pair tables (26 letters) -- the explicit case table the case-mapping helpers expect, built in-language from asciiCells(). asciiUpperSet: the 26 upper-case letters A..Z (ascii index 33..58).
asciiLowerSetString[] asciiLowerSet()asciiLowerSet: the 26 lower-case letters a..z (ascii index 65..90).
toUpperAsciiString toUpperAscii(String[] cells)toUpperAscii / toLowerAscii(cells): case-fold ASCII letters via the ascii pair tables; non-letters pass through unchanged. REAL and honest -- the map is the explicit ASCII case table, nothing about arbitrary Unicode assumed.
toLowerAsciiString toLowerAscii(String[] cells)No description in source.

SLTextReader #sleela 2.5 (lib/text/SLTextReader.sleela)

SLTextReader class

SLTextReader -- a comprehensive buffered text-input contract for >

Carries the standard Metadata Class record — eleven catalogued provenance attributes (version, id, author, date, copyright, trademark, corporation, origin, birth date, science rating, national schedule) with matching get/set accessors. These are omitted from the tables below for brevity.

Fields — the named values this unit stores.

FieldDeclarationWhat it holds
valueString value = ""the source name/path or primed buffer content
charsetString charset = "UTF-8"decoding charset
bufferString buffer = ""in-memory lookahead buffer (in-language)
lineint line = 11-based current line
offsetint offset = 0characters consumed
atEofint atEof = 01 once the source is exhausted

Methods — the actions this unit can perform.

MethodSignatureWhat it does
setvoid set(String v)---- configuration / lifecycle (in-language) ----------------------
getString get()No description in source.
clearvoid clear()No description in source.
setCharsetvoid setCharset(String c)No description in source.
getCharsetString getCharset()No description in source.
primevoid prime(String text)In-memory buffer the caller can prime (useful for tests / piping).
peekBufferString peekBuffer()No description in source.
hasBufferedboolean hasBuffered()No description in source.
dropBuffervoid dropBuffer()No description in source.
lineNumberint lineNumber()Position state (in-language).
positionint position()No description in source.
isEofboolean isEof()No description in source.
markEofvoid markEof()No description in source.
countLinevoid countLine()No description in source.
advancevoid advance(int chars)No description in source.
bridgeString bridge(String op)---- bridged source access (the real I/O) -------------------------
bridgeArgString bridgeArg(String op, String a)No description in source.
openString open()No description in source.
readString read(String count)No description in source.
readCharString readChar()No description in source.
readLineString readLine()No description in source.
readAllString readAll()No description in source.
readyString ready()No description in source.
closeStreamString closeStream()not named close(): close is reserved
typeNameString typeName()---- introspection -------------------------------------------------
availableboolean available()No description in source.
copySLTextReader copy()SLCloneable / SLDisposable intent.
disposevoid dispose()No description in source.

SLTextWriter #sleela 2.5 (lib/text/SLTextWriter.sleela)

SLTextWriter class

SLTextWriter -- a comprehensive buffered text-output contract for >

Carries the standard Metadata Class record — eleven catalogued provenance attributes (version, id, author, date, copyright, trademark, corporation, origin, birth date, science rating, national schedule) with matching get/set accessors. These are omitted from the tables below for brevity.

Fields — the named values this unit stores.

FieldDeclarationWhat it holds
valueString value = ""the sink name/path
charsetString charset = "UTF-8"encoding charset
pendingString pending = ""accumulated, not-yet-flushed text (in-language)
linesint lines = 0lines written into the buffer
editsint edits = 0number of write operations

Methods — the actions this unit can perform.

MethodSignatureWhat it does
setvoid set(String v)---- configuration / lifecycle (in-language) ----------------------
getString get()No description in source.
clearvoid clear()No description in source.
setCharsetvoid setCharset(String c)No description in source.
getCharsetString getCharset()No description in source.
writeSLTextWriter write(String s)---- in-language buffered writes (real; fluent) -------------------
writeIntSLTextWriter writeInt(int n)No description in source.
writeLineSLTextWriter writeLine(String s)No description in source.
newlineSLTextWriter newline()No description in source.
spaceSLTextWriter space()No description in source.
indentSLTextWriter indent(int depth)indent(depth): write depth units of two-space indentation (real).
writeAllSLTextWriter writeAll(String[] parts)writeAll(parts): write every element of a String[] (real).
bufferedString buffered()pending-content inspection (in-language).
hasPendingboolean hasPending()No description in source.
lineCountint lineCount()No description in source.
writeCountint writeCount()No description in source.
bridgeString bridge(String op)---- bridged sink access (the real I/O) ---------------------------
bridgeArgString bridgeArg(String op, String a)No description in source.
openString open()No description in source.
flushString flush()flush(): hand the pending buffer to the runtime sink and clear it locally.
drainString drain()No description in source.
closeStreamString closeStream()not named close(): close is reserved
typeNameString typeName()---- introspection -------------------------------------------------
availableboolean available()No description in source.
copySLTextWriter copy()SLCloneable / SLDisposable intent.
disposevoid dispose()No description in source.

string-cells-demo #sleela 2.5 (lib/text/string-cells-demo.sleela)

SLStringCells class

Carries the standard Metadata Class record — eleven catalogued provenance attributes (version, id, author, date, copyright, trademark, corporation, origin, birth date, science rating, national schedule) with matching get/set accessors. These are omitted from the tables below for brevity.

Methods — the actions this unit can perform.

MethodSignatureWhat it does
joinCellsString joinCells(String[] cells)No description in source.
sliceString[] slice(String[] cells, int from, int to)No description in source.
matchesAtboolean matchesAt(String[] cells, int at, String[] needle)No description in source.
indexOfSeqint indexOfSeq(String[] cells, String[] needle)No description in source.
containsSeqboolean containsSeq(String[] cells, String[] needle)No description in source.
countSeqint countSeq(String[] cells, String[] needle)No description in source.
replaceSeqString replaceSeq(String[] cells, String[] from, String[] to)No description in source.
splitOnString[] splitOn(String[] cells, String sepCell)No description in source.
mapCellString mapCell(String cell, String[] fromSet, String[] toSet)No description in source.
mapString[] map(String[] cells, String[] fromSet, String[] toSet)No description in source.
mapToStringString mapToString(String[] cells, String[] fromSet, String[] toSet)No description in source.
isBlankCellboolean isBlankCell(String cell, String[] blanks)No description in source.
trimString trim(String[] cells, String[] blanks)No description in source.
padCenterString padCenter(String[] cells, int width, String padCell)No description in source.
truncateString truncate(String[] cells, int width, String ellipsisCell)No description in source.
mainvoid main()No description in source.

text-string-demo #sleela 2.5 (lib/text/text-string-demo.sleela)

SLString class

Carries the standard Metadata Class record — eleven catalogued provenance attributes (version, id, author, date, copyright, trademark, corporation, origin, birth date, science rating, national schedule) with matching get/set accessors. These are omitted from the tables below for brevity.

Fields — the named values this unit stores.

FieldDeclarationWhat it holds
valueString value = ""No description in source.

Methods — the actions this unit can perform.

MethodSignatureWhat it does
setvoid set(String v)No description in source.
getString get()No description in source.
withSLString with(String v)No description in source.
copySLString copy()No description in source.
disposevoid dispose()No description in source.
concatString concat(String other)No description in source.
equalsboolean equals(String other)No description in source.
isEmptyboolean isEmpty()No description in source.
appendSLString append(String tail)No description in source.
prependSLString prepend(String head)No description in source.
repeatString repeat(int n)No description in source.
joinString join(String[] parts, String sep)No description in source.
quoteString quote()No description in source.
repeatWithSepString repeatWithSep(int n, String sep)Richer in-language helpers (real; mirror lib/text/SLString).
joinNonEmptyString joinNonEmpty(String[] parts, String sep)No description in source.
equalsAnyOfboolean equalsAnyOf(String[] options)No description in source.
fromCellsString fromCells(String[] cells)Char-cell view: REAL char-level ops over an explicit String[] of glyphs.
lengthCellsint lengthCells(String[] cells)No description in source.
charAtCellsString charAtCells(String[] cells, int i)No description in source.
substringCellsString substringCells(String[] cells, int from, int to)No description in source.
indexOfCellint indexOfCell(String[] cells, String needle)No description in source.
reverseCellsString reverseCells(String[] cells)No description in source.
columnRightString columnRight(String[] cells, int width, String padChar)No description in source.
padCenterCellsString padCenterCells(String[] cells, int width, String padCell)New real char-cell helpers (mirror lib/text/SLString v1.1).
truncateCellsString truncateCells(String[] cells, int width, String ellipsisCell)No description in source.
matchesAtboolean matchesAt(String[] cells, int at, String[] needle)No description in source.
indexOfSeqCellsint indexOfSeqCells(String[] cells, String[] needle)No description in source.
countSeqCellsint countSeqCells(String[] cells, String[] needle)No description in source.
replaceSeqCellsString replaceSeqCells(String[] cells, String[] from, String[] to)No description in source.
mapCellString mapCell(String cv, String[] fromSet, String[] toSet)No description in source.
mapCellsToStringString mapCellsToString(String[] cells, String[] fromSet, String[] toSet)No description in source.
splitCellsOnString[] splitCellsOn(String[] cells, String sepCell)No description in source.
suffixIfString suffixIf(boolean cond, String tail)New pure value helpers + honest bridged declarations.
wrapIfNotEmptyString wrapIfNotEmpty(String left, String right)No description in source.
normalizeString normalize(String form)No description in source.
stripLeadingString stripLeading()No description in source.
bridgeString bridge(String op)Bridged char-level ops -- honest descriptors, never faked.
bridgeArgString bridgeArg(String op, String a)No description in source.
bridgeKindString bridgeKind(String op)No description in source.
lengthString length()No description in source.
toUpperCaseString toUpperCase()No description in source.
indexOfString indexOf(String needle)No description in source.
splitString split(String regex)No description in source.
mainvoid main()No description in source.