CFLib.org – Common Function Library Project

richTextUnicodeFormat(str)

Last updated September 1, 2005

author

Sierra Bufe

Version: 1 | Requires: CF5 | Library: StrLib

Description:
This function allows for the insertion of foreign characters into Rich Text Format (RTF) documents. Strings are formatted into RTF Unicode characters. This is especially handy for replacing keywords (such as name) in a translated RTF.

Return Values:
Returns a string.

Example:

<cfset replacename = richTextUnicodeFormat(Form.ChineseName)>

<cfoutput>#replacename#</cfoutput>

Parameters:

Name Description Required
str String to format. Yes

Full UDF Source:

/**
 * Returns a rich text format unicode string, suitable for keyword replacement in rtf documents.
 * 
 * @param str 	 String to format. (Required)
 * @return Returns a string. 
 * @author Sierra Bufe (sierra@brighterfusion.com) 
 * @version 1, September 1, 2005 
 */
function richTextUnicodeFormat(str) {
	var u = "";
	var i = 1;
	var ch = "";
	
	for (;i lte Len(str);i=i+1) {
		ch = Mid(str, i, 1);
		u = u & "\u" & Asc(ch) & " ~";
	}
	return u;
}
blog comments powered by Disqus

Search CFLib.org


Latest Additions

Kevin Cotton added
date2ExcelDate
May 5, 2016

Raymond Camden added
CapFirst
April 25, 2016

Chris Wigginton added
loremIpsum
January 18, 2016

Gary Stanton added
calculateArrival...
November 19, 2015

Sebastiaan Naafs - van Dijk added
getDaysInQuarter
November 13, 2015

Created by Raymond Camden / Design by Justin Johnson