uemtux Posted October 10, 2013 Posted October 10, 2013 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.
Recommended Posts
This topic is 4130 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now