Skip to main content

StringUtils

Public Static Methods


split

static
Split string by delimiter with optional trimming.

Parameters

  • s Input string
  • result Output vector (appends to existing elements)
  • delim Delimiter string
  • keep_empty Keep empty tokens
  • trim_space Trim whitespace from each token

Returns

Number of characters processed Example:

split

static
Split string by single character delimiter (faster)

trim

static
Trim whitespace from both ends.

ltrim

static
Trim whitespace from left.

rtrim

static
Trim whitespace from right.

join

static
Join strings with delimiter. Example:

to_lower

static
Convert string to lowercase.

to_upper

static
Convert string to uppercase.

starts_with

static
Check if string starts with prefix.

ends_with

static
Check if string ends with suffix.

contains

static
Check if string contains substring.

replace_all

static
Replace all occurrences of ‘from’ with ‘to’.

split_respecting_quotes

static
Split keeping quoted sections intact. Example:

remove_whitespace

static
Remove all whitespace from string.

pad_left

static
Pad string to width with fill character.

pad_right

static

escape_json

static
Escape special characters for JSON.