Help

I need only the first letter of every word Big

Topic Labels: Formulas
10941 20
cancel
Showing results for 
Search instead for 
Did you mean: 
airtableManuel
6 - Interface Innovator
6 - Interface Innovator

From this:
animals > cat > face > eyes
into
Animals/Cat/Face/Eyes

how can i do that i know the first step:

SUBSTITUTE({Category 1}, ’ > ', ‘/’) // this replaces the > into /
and then how can i use the upper case method only for the first letter of every word?
thanks for the help
please write an example code, thanks!

20 Replies 20

It’s possible to cut that formula nearly in half. Instead of searching for each letter twice—once at the start of the string, and again at the start of a word—search for both combinations at the same time. Here’s an example just using “a”:

REGEX_REPLACE({Field Name}, "^a| a", " A")

Expand that out to cover the rest of the alphabet, then trim the result to get rid of any leading space:

TRIM(REGEX_REPLACE(REGEX_REPLACE(REGEX_REPLACE(REGEX_REPLACE(REGEX_REPLACE(REGEX_REPLACE(REGEX_REPLACE(REGEX_REPLACE(REGEX_REPLACE(REGEX_REPLACE(REGEX_REPLACE(REGEX_REPLACE(REGEX_REPLACE(REGEX_REPLACE(REGEX_REPLACE(REGEX_REPLACE(REGEX_REPLACE(REGEX_REPLACE(REGEX_REPLACE(REGEX_REPLACE(REGEX_REPLACE(REGEX_REPLACE(REGEX_REPLACE(REGEX_REPLACE(REGEX_REPLACE(REGEX_REPLACE({Field Name}, "^a| a", " A"), "^b| b", " B"), "^c| c", " C"), "^d| d", " D"), "^e| e", " E"), "^f| f", " F"), "^g| g", " G"), "^h| h", " H"), "^i| i", " I"), "^j| j", " J"), "^k| k", " K"), "^l| l", " L"), "^m| m", " M"), "^n| n", " N"), "^o| o", " O"), "^p| p", " P"), "^q| q", " Q"), "^r| r", " R"), "^s| s", " S"), "^t| t", " T"), "^u| u", " U"), "^v| v", " V"), "^w| w", " W"), "^x| x", " X"), "^y| y", " Y"), "^z| z", " Z"))

Too bad that Airtable’s regex variant doesn’t support the \U substitution token. That will replace a given item with its uppercase equivalent, which would make it possible to shrink that formula down to this:

REGEX_REPLACE(Words, "(^.| .)","\\U$1")

To be clear, that last formula WILL NOT WORK in Airtable. It’s just wishful thinking.