CFLib.org – Common Function Library Project

richTextUnicodeFormat(str)

Last updated September 01, 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;
}

Search CFLib.org


Latest Additions

Raymond Camden added
QueryDeleteRows
November 04, 2017

Leigh added
nullPad
May 11, 2016

Raymond Camden added
stripHTML
May 10, 2016

Kevin Cotton added
date2ExcelDate
May 05, 2016

Raymond Camden added
CapFirst
April 25, 2016

Created by Raymond Camden / Design by Justin Johnson