How to Use String Functions in BigQuery
Last updated July 26, 2026 · By the SaturnSQL team
SUBSTR extracts part of a string, SPLIT breaks it into an array, TRIM removes surrounding characters, LOWER/UPPER change case, and REPLACE swaps a substring.
SELECT
SUBSTR(email, 1, STRPOS(email, '@') - 1) AS username,
LOWER(email) AS email_lower,
TRIM(status) AS status_trimmed
FROM users;Splitting and replacing
SELECT SPLIT(full_name, ' ') AS name_parts,
REPLACE(url, 'http://', 'https://') AS secure_url
FROM users;SUBSTR takes a 1-based start position; a negative start counts from the end of the string, so SUBSTR(email, -4) grabs the last four characters.
Run this in SaturnSQL
SaturnSQL is a browser-based SQL editor for teams: shared query library, schema-aware autocomplete, and scheduled exports to Google Sheets and Slack.
Try it free