Jan 12, 2022 07:18 AM
I have a field that is an entry field and that is part of a rather complicated page design, where I need to be able to trim away and spaces at the end of an entry as sometimes the user ads a whitespace I guess out of habit.
Is this possible?
I’ve been playing around with the TRIM() and SUBSTITUTE(), but I have a hard time finding a solution that’ll apply just to the end of the entry?
I’ve tried this, but it dosen’t get rid of the white space at the end
IF(RIGHT({Alcantara},1)=" ",
LEFT({Alcantara}, FIND(' ', {Alcantara}, LEN({Alcantara})-1),
{Alcantara}
)
Solved! Go to Solution.
Jan 13, 2022 05:44 AM
I’m no expert on the TRIM() function, but normally it only trims the whitespaces in front and at the end of a string, so not the spaces between words. That’s why I found it strange that you’ve tried it, but didn’t deem it a solution. Or am I missing something?
Jan 12, 2022 07:41 AM
Perhaps a dumb question, but why is trimming at the beginning of the string not an option?
Jan 13, 2022 01:32 AM
No entirely sure I understand your question, but maybe thats because my question was not very clear.
I have a very convoluted page-designer that has dozen of work arounds due to some short comings of the page designer. Fx all my headers in a grid changes dynamically - which is a pain in the neck as column and rows does not expand fluidly. So I have a bunch of calculation that figures out how long words can be before it makes page breaks, etc… long story short the accidental white spaces at the end of an input messes all this up.
Fx “Long John Sally” vs "Long John Sally "
So I thought I would ‘clean up’ the inputs. But I can’t figure out if it possible to return the string minus the last whitespaces and not all of them.
I searched the forum, but seems I’m the only one with this problem. I wonder if someone with more experience with regEx thinks it could be done?
Jan 13, 2022 05:44 AM
I’m no expert on the TRIM() function, but normally it only trims the whitespaces in front and at the end of a string, so not the spaces between words. That’s why I found it strange that you’ve tried it, but didn’t deem it a solution. Or am I missing something?
Jan 13, 2022 10:03 AM
Hi Kim,
I agree with Databaser, the TRIM() function should do the work to remove leading and trailing blanks
I did a test just to ensure about that, same as Databaser. Check the screenshot of the table and the formulas.
I was thinking about your text containing “non white spaces” that look like “whitespaces” but TRIM() should also pick them up, see my example where the Raw test field is a long text.
Hopefully this helps, good luck
*Xavier GS
Jan 14, 2022 04:35 AM
You’re so right, not sure where my brain was when reading the TRIM() documentation… :woozy_face:
Thank you both @Databaser & @Xavier_G_Sabater for cutting it for me.
Jan 14, 2022 06:57 AM
There are 2 support pages on TRIM(), but 1 of them was incorrect in stating that TRIM() also removes inner whitespaced. I’ve reported this to Airtable and there are going/already did correct this. That maybe caused the misperception.
Jan 14, 2022 07:54 AM
Ahh, so I might have hit the wrong one…
Thank you for clearing it.