CFLib.org – Common Function Library Project

stripOuterQuotes(string)

Last updated December 13, 2010

author

Pete Ruckelshaus

Version: 0 | Requires: CF5 | Library: StrLib

Description:
Strips doublequotes from the beginning and end of a string. Useful for cleaning up CSV data that uses quoted columns.

Return Values:
Returns a string.

Example:

<cfset sample = """ray""">
<cfoutput>#stripOuterQuotes(sample)#</cfoutput>

Parameters:

Name Description Required
string String to modify. Yes

Full UDF Source:

/**
 * Strips doublequotes from the beginning and end of a string.
 * 
 * @param string      String to modify. (Required)
 * @return Returns a string. 
 * @author Pete Ruckelshaus (pruckelshaus@gmail.com) 
 * @version 0, December 13, 2010 
 */
function stripOuterQuotes(string) {
    if (left(string, 1) EQ """") {
        string = right(string, len(string) -1);
    }
    if (right(string, 1) EQ """") {
        string = left(string, len(string) -1);
    }
    return 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