CFLib.org – Common Function Library Project

AccessPatternMatchingFormat(string)

Last updated August 14, 2002
Download UDF

author

Matthew Walker                                    Matthew Walker

Version: 2 | Requires: ColdFusion 5 | Library: StrLib

Description:
A visitor may enter wildcard characters into a search string without realising. An invalid search string can then produce either a database error or odd results. This is a particular problem with double-byte languages like Japanese where a [ for example may be hidden inside a character.

Return Values:
Returns a string.

Example:

<cfoutput>
"98.3%" becomes "#AccessPatternMatchingFormat("98.3%")#"
</cfoutput>

Parameters:

Name Description Required
string The string to format. Yes

Full UDF Source:

<cfscript>
/**
* Strip pattern-matching wildcards from a string appearing in an Access query.
* Modded list order (rkc 8/14/02)
*
* @param string      The string to format. (Required)
* @return Returns a string.
* @author Matthew Walker (matthew@cabbagetree.co.nz)
* @version 2, August 14, 2002
*/

function AccessPatternMatchingFormat(string) {
    return ReplaceList(string, "[,%,_,##", "[[],[%],[_],[##]");
}
</cfscript>

Search CFLib.org


Latest Additions

Jose Diaz-Salcedo Jose Diaz-Salcedo added
cfRssFeed
3 day(s) ago

Raymond Compton Raymond Compton added
structBlend
23 day(s) ago

Duncan Duncan added
IsZIPUK
23 day(s) ago

Todd Sharp Todd Sharp added
getTagContentAll
29 day(s) ago

Gerald Guido Gerald Guido added
ListReturnDuplicat...
1 month(s) ago

Created by Raymond Camden / Design by Justin Johnson