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

 
Rated 0 time(s). Average Rating: 0

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

Shawn Porter Shawn Porter added
DeMoronize
3 hour(s) ago

Chris Carey Chris Carey added
readPropertiesFi...
1 day(s) ago

Randy Johnson Randy Johnson added
lastDayofWeek
3 day(s) ago

Frank Marion Frank Marion added
sitemapPing
7 day(s) ago

Top Rated

James Sleeman                                     QuickSort
Rated 5.0, 3 time(s)

Barney Boisvert indentXml
Rated 5.0, 3 time(s)

Nathan Dintenfass                                 queryColumnsToSt...
Rated 5.0, 3 time(s)

Kevin Pepperman generateSsccAsn
Rated 5.0, 3 time(s)

Created by Raymond Camden / Design by Justin Johnson