RaggieScript v1.3.0
Browse Table of Contents (17 chapters)
Getting Started (2)
Language Reference (4)
Core Standard Library (3)
Windows, MSI SQL & Native FFI (3)
Wizard UI & Studio Sandboxes (3)
Diagnostics & Bytecode ISA (2)
Master Symbol Index
6 min read Module: raggiesoft.raggiescript F1: IDH_RSSC_NS_DATA (0x2008)

str.*, regex.*, array.*, map.*, time.*, math.*, json.*, ini.* & xml.*

Pure string, regular expression, functional array/map, ISO-8601 time, numeric math, and JSON helpers work across every RaggieScript target (C++20 VM, .NET RaggieScript.Core, and SCORM/Crossroads ES2022), while .ini and .xml file mutations participate automatically in .rsw-rollback.jnl backups!

str.* — UTF-8 String Manipulation (12 Methods)

MethodSignatureReturnDescription
str.lenstr.len(text: string)intReturns length of text.
str.lowerstr.lower(text: string)stringReturns lowercase copy of text.
str.upperstr.upper(text: string)stringReturns uppercase copy of text.
str.trimstr.trim(text: string)stringStrips leading and trailing ASCII/Unicode whitespace.
str.containsstr.contains(haystack: string, needle: string, ignoreCase?: bool)boolReturns true if needle appears in haystack.
str.startsWithstr.startsWith(text: string, prefix: string, ignoreCase?: bool)boolReturns true if text begins with prefix.
str.endsWithstr.endsWith(text: string, suffix: string, ignoreCase?: bool)boolReturns true if text ends with suffix.
str.indexOfstr.indexOf(haystack: string, needle: string, startIndex?: int)intReturns 0-based index of needle, or -1 when absent.
str.replacestr.replace(text: string, oldSub: string, newSub: string, ignoreCase?: bool)stringReplaces all occurrences of oldSub with newSub.
str.splitstr.split(text: string, delimiter?: string)arraySplits text on delimiter (default "\n") into a string[] array.
str.joinstr.join(items: array, separator?: string)stringJoins array elements with separator (default "").
str.slicestr.slice(text: string, start: int, end?: int)stringExtracts substring [start, end).

regex.* — ECMAScript Regular Expressions (3 Methods)

MethodSignatureReturnDescription
regex.isMatchregex.isMatch(input: string, pattern: string, ignoreCase?: bool)boolReturns true if input matches ECMAScript regex pattern.
regex.matchregex.match(input: string, pattern: string, ignoreCase?: bool)arrayReturns [fullMatch, group1, group2, ...] for the first match (or [] if none).
regex.replaceregex.replace(input: string, pattern: string, replacement: string, ignoreCase?: bool)stringReplaces regex matches using standard $1, $2 replacement groups.

array.* — Functional Collection Operations (12 Methods)

array.map, array.filter, array.find, array.any, array.all, and array.reduce invoke first-class RaggieScript closures (item => ...) directly inside the linear stack VM, .NET runtime, and ES2022:

MethodSignatureReturnDescription
array.pusharray.push(list: array, item: any)intAppends item and returns the new length.
array.maparray.map(list: array, transformFn: fn)arrayCalls transformFn(item) for each element and returns the mapped array.
array.filterarray.filter(list: array, predicateFn: fn)arrayKeeps elements for which predicateFn(item) returns truthy.
array.containsarray.contains(list: array, needle: any)boolStructural equality membership check.
array.findarray.find(list: array, predicateFn: fn)anyReturns the first element matching predicateFn(item), or null.
array.anyarray.any(list: array, predicateFn: fn)boolReturns true if at least one element satisfies predicateFn(item).
array.allarray.all(list: array, predicateFn: fn)boolReturns true if every element satisfies predicateFn(item).
array.reducearray.reduce(list: array, initial: any, reducerFn: fn)anyFolds list left-to-right via (acc, item) => nextAcc.
array.sortarray.sort(list: array)arrayReturns a sorted copy (preserving SemVer, numeric, and UTF-8 ordering).
array.uniquearray.unique(list: array)arrayReturns a copy with duplicate values removed while preserving first-seen order.
array.slicearray.slice(list: array, start: int, end?: int)arrayExtracts sub-array [start, end).
array.reversearray.reverse(list: array)arrayReturns a reversed copy of list.
const rawPorts = [" 443 ", " 8080 ", " 80 "];
const highPorts = array.filter(
    array.map(rawPorts, s => int(str.trim(s))),
    p => p >= 1024
); // -> [8080]

map.* — Dictionary & Struct Inspection (6 Methods)

MethodSignatureReturnDescription
map.keysmap.keys(record: map)arrayReturns sorted key names of record (excluding internal __struct tags).
map.valuesmap.values(record: map)arrayReturns values stored in record.
map.entriesmap.entries(record: map)arrayReturns [key, value] two-element pairs for record.
map.hasmap.has(record: map, key: string)boolReturns true if record defines key.
map.mergemap.merge(baseMap: map, patchMap: map)mapReturns a shallow-merged copy of baseMap overwritten by patchMap.
map.removemap.remove(record: map, key: string)boolDeletes key in place and returns true if it was present.

time.* — ISO-8601 Timestamps, Monotonic Stopwatch & SCORM Durations (9 Methods)

MethodSignatureReturnDescription
time.nowUtctime.nowUtc()stringCurrent UTC timestamp in ISO-8601 format ("2026-11-27T23:45:00Z").
time.nowLocaltime.nowLocal()stringCurrent local timestamp ("2026-11-27T18:45:00").
time.unixSecondstime.unixSeconds()intCurrent Unix epoch timestamp in seconds.
time.unixMillistime.unixMillis()intCurrent Unix epoch timestamp in milliseconds.
time.stopwatchMstime.stopwatchMs()intHigh-resolution monotonic elapsed milliseconds (QueryPerformanceCounter / Stopwatch).
time.formatUtctime.formatUtc(unixSeconds: int, pattern?: string)stringFormats unixSeconds in UTC ("ISO8601", "YYYY-MM-DD", "YYYYMMDD-HHmmss", or strftime).
time.formatLocaltime.formatLocal(unixSeconds: int, pattern?: string)stringFormats unixSeconds in local time.
time.parseIsotime.parseIso(isoString: string)intParses an ISO-8601 UTC date/timestamp into Unix epoch seconds.
time.formatScormDurationtime.formatScormDuration(seconds: float)stringFormats elapsed seconds as a SCORM 2004 4th Edition ISO-8601 duration ("PT14M22S").

math.* — Clamping, Interpolation & Numeric Constants (10 Methods + 2 Properties)

Includes built-in constants math.PI (3.141592653589793) and math.E (2.718281828459045):

MethodSignatureReturnDescription
math.minmath.min(a: any, b: any)int | floatReturns the smaller of a and b.
math.maxmath.max(a: any, b: any)int | floatReturns the larger of a and b.
math.clampmath.clamp(value: any, minVal: any, maxVal: any)int | floatClamps value into [minVal, maxVal].
math.absmath.abs(x: any)int | floatReturns absolute magnitude of x.
math.roundmath.round(x: float, digits?: int)floatRounds x to digits decimal places (0 by default).
math.floormath.floor(x: float)intLargest integer <= x.
math.ceilmath.ceil(x: float)intSmallest integer >= x.
math.powmath.pow(base: float, exponent: float)floatComputes base raised to exponent.
math.sqrtmath.sqrt(x: float)floatComputes non-negative square root of x.
math.lerpmath.lerp(a: float, b: float, t: float)floatLinear interpolation a + (b - a) * t.

json.* — Structured JSON Parse & Serialize (2 Methods)

MethodSignatureReturnDescription
json.parsejson.parse(jsonText: string)anyParses UTF-8 JSON into nested RaggieScript maps, arrays, and primitives.
json.stringifyjson.stringify(value: any, pretty?: bool)stringSerializes any value (including struct instances) to valid comment-free UTF-8 JSON.

ini.* & xml.* — Configuration File Surgery (8 Methods)

MethodSignatureReturnMutating?Description
ini.readini.read(file: path, section: string, key: string, fallback?: string)stringRead-OnlyReads [section] key from a UTF-8/UTF-16 .ini file.
ini.sectionsini.sections(file: path)arrayRead-OnlyLists all [Section] names in file.
ini.writeini.write(file: path, section: string, key: string, value: any)boolMutating (RSW701)Writes [section] key=value with automatic .rswbak rollback backup.
ini.deleteKeyini.deleteKey(file: path, section: string, key: string)boolMutating (RSW701)Deletes key from [section] (rollback-protected).
xml.readTextxml.readText(file: path, elementTagOrPath: string, fallback?: string)stringRead-OnlyReads inner text of a matching XML element.
xml.readAttrxml.readAttr(file: path, elementTag: string, attrName: string, fallback?: string)stringRead-OnlyReads attrName from an XML element.
xml.replaceAttrxml.replaceAttr(file: path, elementTag: string, attrName: string, newValue: string)boolMutating (RSW701)Updates an XML attribute value in-place with .rswbak rollback protection.
xml.setElementTextxml.setElementText(file: path, elementTag: string, innerText: string)boolMutating (RSW701)Updates inner text of an XML element with .rswbak rollback protection.
Indexed API Calls & Symbols on This Page (31):