CFLib.org – Common Function Library Project

WAPSafe(string)

Last updated April 24, 2002

author

Ben Forta

Version: 2 | Requires: CF5 | Library: StrLib

Description:
Returns a WAP safe string. All dollar signs ($) are escaped ($$). All ampersands (&) are escaped (&).

Return Values:
Returns a string.

Example:

<CFOUTPUT>
<CFSET STR = "Some random string that may have a $ or & in it.">
The WAPSafe version of<BR>
<FONT COLOR="green">#STR#</FONT><BR>
is:<BR>
<FONT COLOR="green">#WapSafe(STR)#</FONT>
</CFOUTPUT>

Parameters:

Name Description Required
string The string to format. Yes

Full UDF Source:

/**
 * Returns a WAP safe string.
 * Update by anthony petruzzi
 * 
 * @param string      The string to format. 
 * @return Returns a string. 
 * @author Ben Forta (ben@forta.com) 
 * @version 2, April 24, 2002 
 */
function WAPSafe(string) {
        string = Replace(string, "&", "&amp;", "ALL");
    return Replace(string, "$", "$$", "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