Brian Dunning's FileMaker Custom Functions

RemoveCarriages ( text )

Removes Multi carriage returns within a text

  Average rating: 4.4 (30 votes) Log in to vote

abhaya   abhaya
Mindfire solutions
http://www.mindfiresolutions.com/

Share on Facebook Share on Twitter

  Sample input:
Input Text:
"1¶2¶3¶4¶4¶¶4¶¶¶¶¶¶¶¶5¶¶¶¶¶¶¶¶¶¶¶¶6:
  Sample output:
"1¶2¶3¶4¶4¶4¶5¶6"

  Function definition: (Copy & paste into FileMaker's Edit Custom Function window)

It will only replaces the no of carriages returns within the input text and keeps only one in each case. Means if there are 4 consecutive carriage returns in some place then it will replace all and keep only a single one.

 

Comments

Lee Smith   Lee Smith
Aug 22, 2014
I’m not getting this to work out-of-the-box.

I remember other CFs that can do this, take a look at RemoveExtraReturns?
 
Bruce Robertson   Bruce Robertson
Aug 23, 2014
So you accomplish what here?

This seems to demonstrate that even with a really simple problem statement, solved successfully by others, you propose a solution which does not work, which changes the user's data if # characters already exist in the user's data, which requires outside technical review and mods to eventually achieve a functioning and reliable result.
 
unix   unix, Japan
Aug 25, 2014
Interesting but
In place of this "#", you can take any chacarter.
is wrong, since "¶" is not allowed.
you should change "#" to a character not used in text
may be right.
Something like Char(1) may be used any case.
 
abhaya   abhaya, BBSR
Aug 25, 2014
Yes, There is also a CF which is doing the same.

But here I mentioned this as it is simpy a 1 line code that replaces all the carriage returns only within the text. In once cases I found some values(field values) which have more no of carriage returns and I want to remove that. So I did it to replaces all the extra carriage returns withins that field values.

Below is the data that needs to be passed by this custom function.
23¶567¶¶43¶23¶¶¶89 and it should be like this 23¶567¶43¶23¶89.

I haven't also tested for other character. Thanks Unix for showing me the same.
 
CesarRG   CesarRG, Oviedo, Spain
Mar 9, 2015
Your original function

1#¶¶2¶¶¶¶2¶¶ return 12¶2

The function with the clarification of unix, returns

Substitute ( Text ; ["¶¶" ; "¶" & Char(1) ];[Char(1) & "¶";""] ;[Char(1);""] )

1#¶¶2¶¶¶¶2¶¶ return 1#¶2¶2


Change the function to unix clarification
 

Log in to post comments.

 

Note: these functions are not guaranteed or supported by BrianDunning.com. Please contact the individual developer with any questions or problems.

Support this website.

This library has been a free commmunity resource for FileMaker users and developers for 20 years. It receives no funding and has no advertisements. If it has helped you out, I'd really appreciate it if you could contribute whatever you think it's worth: