CFLib.org – Common Function Library Project

IsMSSQLGUID(str)

Last updated October 03, 2002

author

Michael Slatoff

Version: 2 | Requires: CF5 | Library: StrLib

Description:
Returns true if the string is a MS SQL GUID.

Return Values:
Returns a boolean.

Example:

<cfset t = arrayNew(1)>
<cfset t[1] = "ray">
<cfset t[2] = createUUID()>
<cfset t[3] = createGUID()>

<cfloop index="x" from=1 to="#arrayLen(t)#">
    <cfoutput>
    Is #t[x]# a MS SQL GUID? #isMSSQLGUID(t[x])#<br>
    </cfoutput>
</cfloop>

Parameters:

Name Description Required
str String to check. Yes

Full UDF Source:

/**
 * Returns true if the string is a MS SQL GUID.
 * Version 2 by Raymond Camden
 * 
 * @param str      String to check. (Required)
 * @return Returns a boolean. 
 * @author Michael Slatoff (Michael@Slatoff.com) 
 * @version 2, October 3, 2002 
 */
function IsMSSQLGUID(str) {
    return (reFindNoCase("[0-9a-f]{8,8}-[0-9a-f]{4,4}-[0-9a-f]{4,4}-[0-9a-f]{4,4}-[0-9a-f]{12,12}",str) is 1 and len(str) is 36);

}

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