Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Built-in Methods

CXL provides 68 built-in scalar methods organized into 8 categories. Methods are called on a receiver value using dot notation: receiver.method(args).

Null propagation

Most methods return null when the receiver is null. This means null values flow through method chains without causing errors. The exceptions are documented in Introspection & Debug.

Method categories

String Methods (24 methods)

Text manipulation: case conversion, trimming, padding, searching, splitting, regex matching.

MethodDescription
upper, lowerCase conversion
trim, trim_start, trim_endWhitespace removal
starts_with, ends_with, containsSubstring testing
replaceFind and replace
substring, left, rightExtraction
pad_left, pad_rightPadding
repeat, reverseRepetition and reversal
lengthCharacter count
split, joinSplitting and joining
matches, find, captureRegex operations
format, concatFormatting and concatenation

Numeric Methods (8 methods)

Rounding, clamping, and comparison for integers and floats.

MethodDescription
absAbsolute value
ceil, floorCeiling and floor
round, round_toRounding to decimal places
clampConstrain to range
min, maxPairwise minimum/maximum

Date & Time Methods (13 methods)

Date component extraction, arithmetic, and formatting.

MethodDescription
year, month, dayDate component extraction
hour, minute, secondTime component extraction (DateTime only)
add_days, add_months, add_yearsDate arithmetic
diff_days, diff_months, diff_yearsDate difference
format_dateCustom date formatting

Conversion Methods (11 methods)

Type conversion in strict (error on failure) and lenient (null on failure) variants.

MethodDescription
to_int, to_float, to_string, to_boolStrict conversion
to_date, to_datetimeStrict date parsing
try_int, try_float, try_boolLenient conversion
try_date, try_datetimeLenient date parsing

Introspection & Debug (5 methods)

Type inspection, null checking, and debugging. These are the only methods that accept null receivers without propagating null.

MethodDescription
type_ofReturns the type name as a string
is_nullTests for null
is_emptyTests for empty string, empty array, or null
catchNull fallback (equivalent to ??)
debugPassthrough with tracing side effect

Path Methods (5 methods)

File path component extraction.

MethodDescription
file_nameFull filename with extension
file_stemFilename without extension
extensionFile extension
parentParent directory path
parent_nameParent directory name