Convert first letter to uppercase in Big Query
I want to convert "i want to buy bananas" -> "I Want To Buy Bananas". How do I it?
Below example is fr BigQuery Standrad SQL
#standardSQL CREATE TEMP FUNCTION PROPER(str STRING) AS (( SELECT STRING_AGG(CONCAT(UPPER(SUBSTR(w,1,1)), LOWER(SUBSTR(w,2))), ' ' ORDER BY pos) FROM UNNEST(SPLIT(str, ' ')) w WITH OFFSET pos )); WITH `project.dataset.table` AS ( SELECT 'i Want to buy bananas' str ) SELECT str, PROPER(str) proper_str FROM `project.dataset.table`
Row str proper_str 1 i Want to buy bananas I Want To Buy Bananas
Read great educational content like this and a lot more !
Members get free exclusive access to content, new courses, and discounts. Signup for a free account to write a post / comment / upvote posts. Creating an account takes less than 5 seconds and you can start earning badges & points too