TextToHTMLCode ( )

Function stats

Average user rating
37
176
9999
Support
FileMaker 10.0 +
Date posted
08 January 2009
Last updated
15 May 2009
Version
Recursive function
Yes

Author Info
 Fabrice

74 functions

Average Rating 4.4

author_avatar



 

Function overview

Prototype

TextToHTMLCode  ( _text )


Parameters

_text  


Description

Tags:  Text   HTML   Encoding  

Converts a text into a html (unicode) compatible string.
Common characters are not modified but accented characters as well as special punctuation are converted into a &#___; code

Requires FileMaker 1

Examples

Sample input

TextToHTMLCode ( "Smith&Wesson" )


Sample output

Smith&Wesson

 

Function code

/* TextToHTMLCode ( _text )

by Fabrice Nordmann

v. ß0.2 -- BETA VERSION DO NOT USE IN PRODUCTION



Converts a text into a html (unicode) compatible string.
Common characters are not modified but accented characters as well as special punctuation are converted into a &#___; code

Requires FileMaker 10

/!\ This is a recursive function limited to 10,000 character long texts. Requires adaptations for longer texts.
*/


Case ( not IsEmpty ( _text )
; Let ([
_l = Left ( _text ; 1 )
; _r = Right ( _text ; Length ( _text ) - 1 )
; _result = Case ( PatternCount ( " abcdefghijklmnopqrstuvwxyz1234567890!()$=+:/;.,?#@-¶\"\'" ; Lower ( _l )) ; _l ; "&#" & Code ( _l ) & ";" )
];
_result & TextToHTMLCode ( _r )
)

)

// ===================================
/*

    This function is published on FileMaker Custom Functions
    to check for updates and provide feedback and bug reports
    please visit http://www.fmfunctions.com/fid/176

    Prototype: TextToHTMLCode( _text )
    Function Author: Fabrice (http://www.fmfunctions.com/mid/37)
    Last updated: 15 May 2009
    Version: 1.4

*/
// ===================================

 

 

 

 

 

 

 

Top Tags

Text Parsing  (33)
List  (31)
Date  (28)
XML  (26)
Format  (23)
Sql  (22)
Dev  (20)
Debug  (17)
Interface  (15)
Layout  (15)
Text  (14)
Variables  (12)
Layout Objects  (11)
Filter  (11)
Design  (10)
Array  (7)