Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
capitalize function in bigquery
CREATE TEMPORARY FUNCTION capitalize(str STRING)
RETURNS STRING
LANGUAGE js AS """
return str.replace(
/\\w\\S*/g,
function(txt) {
return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();
}
);
""";
@Sillson

This comment has been minimized.

Copy link
Owner Author

Sillson commented Sep 19, 2018

#Importante
make sure you CASE when there could be null values

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.