Components | All | New | MacOS | Windows | Linux | iOS | ||||
Examples | Mac & Win | Server | Client | Guides | Statistic | FMM | Blog | Deprecated | Old |
Text.ReplaceNewline
Replaces newline characters.
Component | Version | macOS | Windows | Linux | Server | iOS SDK |
Text | 2.4 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |
(old name: String.ReplaceNewline)
Parameters
Parameter | Description | Example | Flags |
---|---|---|---|
Text | The text to process. | "Hello World" | |
Mode | The operation mode. First a value for the output newline type: 0: nothing 1: CR (Mac) 2: LF (Unix) 3: CRLF (Windows) 4: <br> for html 5: <br /> for xml Second you can add 8 to remove duplicate newlines. |
||
Wrap | Optional whether to wrap lines longer than given number of characters. Default is 0 for no wrap. | 80 | Optional |
Result
Text with modified newline characters.
Description
Replaces newline characters.Can remove, convert to Mac, Windows and Linux specific end of line characters. Also can remove duplicates.
FileMaker uses Mac line endings on all platforms.
Like ReplaceLineEndings in Xojo to replace line breaks.
This function works on pure text, so any text style is lost. And it truncates on first NULL byte.
Examples
Remove newlines from field:
MBS( "Text.ReplaceNewline"; Test Database::TextField; 0 )
Replaces newlines from field with Mac newlines:
MBS( "Text.ReplaceNewline"; Test Database::TextField; 1 )
Replaces newlines from field with Mac newlines and remove duplicates:
MBS( "Text.ReplaceNewline"; Test Database::TextField; 1+8 )
Write UTF-8 CRLF file:
Set Variable [ $text ; Value: "Joe,1234 Main St.¶John Glen,3132 Elm¶Johnson,5233 Wreybird¶Ray,263 Birch¶äöü" ]
Set Variable [ $path ; Value: "/Users/cs/Desktop/test.txt" ]
Set Variable [ $text ; Value: MBS( "Text.ReplaceNewline"; $text; 3) // CRLF ]
Set Variable [ $r ; Value: MBS( "Text.WriteTextFile"; $text; $path; "UTF8" ) ]
Change line endings for a text file:
Set Variable [ $path ; Value: "/Users/cs/Desktop/test.txt" ]
Set Variable [ $text ; Value: MBS("Text.ReadTextFile"; $path; "UTF-8") ]
Set Variable [ $text ; Value: MBS("Text.ReplaceNewline"; $text; 3)
// 1 = CR for Mac
// 2 = LF for Linux
// 3 = CRLF for Windows ]
Set Variable [ $r ; Value: MBS("Text.WriteTextFile"; $text; $path; "UTF-8") ]
See also
- SendMail.SetHTMLText
- Shell.ReadOutputText
- Text.AppendTextFile
- Text.EncodeToHTML
- Text.ReadEMLXFile
- Text.ReadTextFile
- Text.RemoveNewLine
- Text.WriteTextFile
- WebHook.SetAutoAnswer
- WebRequest.Send
Example Databases
- Barcode/Barcodes from Invoices
- Barcode/EPC-QR-Code
- Barcode/Swiss QR-Code for invoices/Swiss QR-Code for invoices ISO 20022
- CURL/CURL Low Level Sockets
- DynaPDF/Swiss QRCode
- Network/HTTP Server hosted
- Network/TCP Socket
- Shell/RunTask/Run Shell Script on Mac
- Text functions/Write Text File
- WebViewer/Text To WebViewer
Blog Entries
- Trigger Scripts via WebHook
- SMTP with OAuth for Office 365 in FileMaker
- WebHook Introduction
- Sending email with a huge custom function
- Generate EPC-QR-Code in FileMaker
- Import CSV with Matrix functions
- Swiss QR-Codes for invoices as vector graphics
- FileMaker 18 File Script Steps vs. BinaryFile functions
- Text to Webviewer Script for FileMaker
- Email Script for FileMaker
FileMaker Magazin
This function checks for a license.
Created 18th August 2014, last changed 7th June 2024