October 10, 201312 yr Name & Parameters: HTMLEntities( text ; pointer ; store )Description: Converts punctuation and symbols in 'text' to HTML entities, starting at position 'pointer' Set the 'store' parameter to "" - If you give it a value it will prefix your output with that value. Caution: This function will render inputted HTML non-functional. Since it will destroy the tags by replacing < and > with HTML entities. Recursive: YesSample Input: Hi, I'm some text with some symbols or punctuation to convert to HTML entities! ?&/ Results: Hi, I'm some text with some symbols or punctuation to convert to HTML entities! ?&/ Formula: /* HTMLEntities Converts punctuation/symbol characters in text into HTML entities, starting at position pointer Free to use - attribution to my fmforums nickname would be nice uemtux Oct 10, 2013 */ Let( [ step = Middle(text ; pointer ; 1); step = Case( //step = " " ; " " ; // Uncomment to replace spaces with entity codes step = "!" ; "!" ; step = """ ; """ ; step = "#" ; "#" ; step = "$" ; "$" ; step = "%" ; "%" ; step = "&" ; "&" ; step = "'" ; "'" ; step = "(" ; "(" ; step = ")" ; ")" ; step = "*" ; "*" ; step = "+" ; "+" ; step = "," ; "," ; step = "-" ; "-" ; step = "." ; "." ; step = "/" ; "/" ; step = ":" ; ":" ; step = ";" ; ";" ; step = "<" ; "<" ; step = "=" ; "=" ; step = ">" ; ">" ; step = "?" ; "?" ; step = "@" ; "@" ; step = "[" ; "[" ; step = "" ; "\" ; step = "]" ; "]" ; step = "^" ; "^" ; step = "_" ; "_" ; step = "`" ; "`" ; step = "{" ; "{" ; step = "|" ; "|" ; step = "}" ; "}" ; step = "~" ; "~" ; step); store = store & step; pointer = pointer + 1 ]; Case(pointer > Length(text) ; store ; HTMLEntities(text ; pointer ; store)) ) Required Functions: None. Credits: Got my info here: http://www.w3schools.com/tags/ref_ascii.asp Disclaimer: FM Forums does not endorse or warrantee these functions are fit for any particular purpose. Do not post or distribute files without written approval from the copyright owner. All files are deemed public domain unless otherwise indictated. Please backup every file that you intend to modify.
Create an account or sign in to comment