CFLib.org – Common Function Library Project

AccessPatternMatchingFormat(string)

Last updated August 14, 2002

author

Matthew Walker

Version: 2 | Requires: CF5 | 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:

/**
 * 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, "[,%,_,##", "[[],[%],[_],[##]");
}

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