BobWeaver Posted March 27, 2005 Share Posted March 27, 2005 You'd think that there would have been a built-in function to trim white space characters (<space>, <tab>, <CR>) from the beginning and end of a text string, but the Trim() function only trims spaces. The following formula will trim off all white space characters from the beginning and end of a text string, but leave any embedded ones intact. Let([t=InputText; tab=" "; //The literal contains a tab character L=Left(t;Position(t;LeftWords(t;1);1;1)-1); L1=Substitute("x"&L;[" ";"s"];[ Link to comment Share on other sites More sharing options...
Søren Dyhr Posted March 27, 2005 Share Posted March 27, 2005 You mentioned it in the end, why not use: Substitute ( MiddleWords(Substitute ( Input ; "." ; " Link to comment Share on other sites More sharing options...
QuinTech Posted March 28, 2005 Share Posted March 28, 2005 How does one type the " Link to comment Share on other sites More sharing options...
Lee Smith Posted March 28, 2005 Share Posted March 28, 2005 Option o on a Mac. Probably not doable on a XP. LOL Lede Link to comment Share on other sites More sharing options...
Søren Dyhr Posted March 29, 2005 Share Posted March 29, 2005 How does one type the " Link to comment Share on other sites More sharing options...
Vaughan Posted March 29, 2005 Share Posted March 29, 2005 So just for giggles S Link to comment Share on other sites More sharing options...
BobWeaver Posted March 29, 2005 Author Share Posted March 29, 2005 Ahem.... Just to get back to the original discussion. For S Link to comment Share on other sites More sharing options...
netbuilder Posted August 22, 2005 Share Posted August 22, 2005 (edited) Bob, I'm interested in using your formula to 'clean' data... I'm wondering if you could upload an FMP file with it embedded that I could just copy/paste from? (My browser window drops all special characters from your formula, rendering it incomplete.) Thanks, Jim Edited August 22, 2005 by Guest Link to comment Share on other sites More sharing options...
jscooper Posted September 7, 2005 Share Posted September 7, 2005 Do you have developer/advanced? If so, you can use a recursive function such as: TrimP(text)= // TrimP strips spaces and carriage returns from text Case( Left(text;1)="¶" or Left(text;1) = " "; TrimP(Right(text;Length(text)-1)); Right(text;1)="¶" or Right(text;1) = " "; TrimP(Left(text;Length(text)-1)); text) This just removed paragraph marks and spaces, but you can set it to get rid of whatever you want. Jeff Link to comment Share on other sites More sharing options...
BobWeaver Posted October 4, 2005 Author Share Posted October 4, 2005 Hi Jim, Sorry it took so long to reply. I've been away. Here is an example file. WhitespaceTrim.fp7.zip Link to comment Share on other sites More sharing options...
Ano Nimus Posted October 7, 2005 Share Posted October 7, 2005 ø = alt+0248 ;) Link to comment Share on other sites More sharing options...
Recommended Posts