CFLib.org – Common Function Library Project

unicodeToJS(str)

Last updated August 31, 2004

author

Harry Klein

Version: 1 | Requires: CF5 | Library: StrLib

Description:
Replace html unicode strings with strings in javascript format. Useful if you save Javascript Strings in WDXX Files.

Return Values:
Returns a string.

Example:

<cfoutput>#unicodeToJS("&##xE4;")#</cfoutput>

Parameters:

Name Description Required
str String to modify. Yes

Full UDF Source:

/**
 * Replace html unicode strings with strings in javascript format.
 * 
 * @param str      String to modify. (Required)
 * @return Returns a string. 
 * @author Harry Klein (klein@contens.de) 
 * @version 1, August 31, 2004 
 */
function unicodeToJS(str){
    str = JSStringFormat(str);
    return ReReplaceNoCase(str,"&##([a-z0-9]{3});","\\1","all");
}

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