Validation & Utility Functions
Validate, format, and transform data
Validation & Utility Functions
Helper functions for validation, formatting, and data transformation.
Validation Functions
validate_email
Validate email address format.
Category: Contact
Type: Utility
Data Types: email, boolean
columns:
- name: email_valid
function: validate_email
Returns: true or false
validate_phone
Validate phone number format.
Category: Contact
Type: Utility
Data Types: phone, boolean
columns:
- name: phone_valid
function: validate_phone
Validates 10-15 digit phone numbers.
Returns: true or false
Extraction Functions
extract_domain
Extract domain from email address.
Category: Contact
Type: Utility
Data Types: email, string
columns:
- name: email_domain
function: extract_domain
Example:
- Input:
[email protected] - Output:
example.com
Formatting Functions
normalize_phone
Normalize phone number to standard US format.
Category: Contact
Type: Utility
Data Types: phone, string
columns:
- name: formatted_phone
function: normalize_phone
Examples:
-
Input:
5551234567 -
Output:
(555) 123-4567 -
Input:
15551234567 -
Output:
+1 (555) 123-4567
format_currency
Format number as currency.
Category: Finance
Type: Utility
Data Types: decimal, float, money, string
| Parameter | Type | Default | Description |
|---|---|---|---|
currency | string | USD | Currency code |
columns:
- name: formatted_amount
function: format_currency
parameters:
currency: USD
Example:
- Input:
1234.5 - Output:
$1,234.50
clean_whitespace
Clean and normalize whitespace.
Category: Text
Type: Utility
Data Types: string, text
Replaces multiple whitespace with single space and trims.
columns:
- name: cleaned_text
function: clean_whitespace
Example:
- Input:
Hello World - Output:
Hello World
Calculation Functions
calculate_age
Calculate age from birthdate.
Category: DateTime
Type: Utility
Data Types: date, integer
columns:
- name: current_age
function: calculate_age
Example:
- Input:
1990-05-15 - Output:
34(as of 2024)
Conversion Functions
string_to_int
Convert string to integer safely.
Category: Numeric
Type: Utility
Data Types: string, integer
| Parameter | Type | Default | Description |
|---|---|---|---|
default | integer | 0 | Value if conversion fails |
columns:
- name: quantity
function: string_to_int
parameters:
default: 0
string_to_float
Convert string to float safely.
Category: Numeric
Type: Utility
Data Types: string, decimal, float
| Parameter | Type | Default | Description |
|---|---|---|---|
default | float | 0.0 | Value if conversion fails |
columns:
- name: amount
function: string_to_float
parameters:
default: 0.0
Related Functions
- Masking Functions - Data masking
- Text Functions - Text generation