Topics   All   MacOS (Only)   Windows (Only)   Linux (Only, Not)   iOS (Only, Not)  
Components   Crossplatform Mac & Win   Server   Client   Old   Deprecated   Guides   Examples   Videos
New in version: 10.1   10.2   10.3   10.4   10.5   11.0   11.1   11.2   11.3   11.4    Statistic    FMM    Blog  


Adds line numbers to text.

Component Version macOS Windows Linux Server iOS SDK
Text 8.3 ✅ Yes ✅ Yes ✅ Yes ✅ Yes ✅ Yes
MBS( "Text.AddLineNumbers"; Text { ; StyleTemplate; Delimiter; Prefix } )   More


Parameter Description Example Flags
Text The text to process. "Hello World"
StyleTemplate The styled text to use as template for line numbers.
We only use style for the nubers and text is ignored.
If empty, this parameter is ignored.
TextFont("test"; "Courier"; "") Optional
Delimiter The optional delimiter.
Default are two space characters.
": " Optional
Prefix Available in MBS FileMaker Plugin 10.3 or newer.
The prefix to put before the number.


Returns text or error.


Adds line numbers to text.
Preserves the styles in the text and adds line numbers as prefix.
Depending on how many lines we have, we may use 2 to 6 digits for numbers.
Works fine for JSON, XML, JavaScript, HTML or any other text.

See also XML.Format & JSON.Format to format and XML.Colorize & JSON.Colorize for colors.


Format, colorize and apply line numbers:

MBS( "Text.AddLineNumbers";
    // colorize it
            // format before colorize
        MBS( "JSON.Format"; JSON Input)
    // define which style to use for numbers
    TextColor (
        TextFont ( " "; "Courier" );
        RGB ( 0 ; 0 ; 255 )

Add <> around numbers:

MBS( "Text.AddLineNumbers"; "Hello¶World¶Test"; ""; "> "; "<" )

See also

Release notes

Example Databases

Blog Entries


Created 27th May 2018, last changed 1st July 2020

TAPI.Unpark - Text.AppendTextFile

Feedback: Report problem or ask question.

MBS Xojo Plugins

Start Chat