Skip to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Cut carriage return from text field¶

Featured Replies

I have a text field where I want to be able to remove any carriage returns which are at the end of the text (while keeping carriage returns which are in the middle). To get rid of one is easy:

case(right(field;1)= "¶" ; left (field;length(field)-1)

However, there may be more than one carriage return at the end of the text. It is quite common to have 2 or 3, but on occasions there have been 20+.

So, is there a tidy way to remove all these extra carriage returns using a calculation?

An example of the text in the field (using ¶ as a carrriage return):)

"Price Guide: £20¶

double £40¶

suite $80¶

¶"

In the above text example I would want to remove the final four paragraph characters.

I have a recursive custom function to do just that.

xCF_RemoveFormat_Full ( text )

Let( [ Format = Trim ( TextFormatRemove ( If ( Right ( Text ; 1 ) = "¶" ; Replace ( Text ; Length ( Text ) ; 1 ; "" ) ; Text ) ) )



];



If ( Right ( Format ; 1 ) = "¶" ; xCF_RemoveFormat_Full ( Format ); Format ) )

Edited by Guest

Substitute ( Trim ( Substitute ( field ; [ " " ; "§" ] ; [ ¶ ; " " ] ) ) ; [ " " ; ¶ ] ; [ "§" ; " " ] )

Those using v7 can also use the following which was originally posted by comment back in '05.

That's a neat idea.

Or you could use PatternCount() to deal only with the last occurence, something like:

Let ( [

crRun = "����������" ;

textCR = text & crRun ;

last = PatternCount ( textCR ; crRun ) ;

pos = Position ( textCR ; crRun ; 1 ; last )

] ;

Left ( textCR ; pos - 1 )

)

Note: n carriage returns in 'crRun' will remove up to n-1 carriage returns - always at the end.

full topic can be found at: http://fmforums.com/forum/showtopic.php?tid/168001/post/168343

  • Author

Thanks for that solution strangler. Never knew could do recursive custom functions! Has opened up a whole new world of possibilities!

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.