CFLib.org – Common Function Library Project

IsCFUUID(str)

Last updated November 25, 2003

author

Jason Ellison

Version: 1 | Requires: CF5 | Library: StrLib

Description:
Checks to see if the string passed is a valid CF-style UUID. A valid UUID is a string which matches the outputed format of the CreateUUID function. Please note that there is a difference between ColdFusion-style UUIDs and Microsoft style UUIDs.

Return Values:
Returns a boolean.

Example:

<CFSET UUID = CreateUUID()>
<CFSET BAD = "Ray">
<CFOUTPUT>
Is #UUID# a UUID? #YesNoFormat(IsCFUUID(UUID))#<BR>
Is #BAD# a UUID? #YesNoFormat(IsCFUUID(BAD))#<BR>
</CFOUTPUT>

Parameters:

Name Description Required
str String to be checked. Yes

Full UDF Source:

/**
 * Returns TRUE if the string is a valid CF UUID.
 * 
 * @param str      String to be checked. (Required)
 * @return Returns a boolean. 
 * @author Jason Ellison (jgedev@hotmail.com) 
 * @version 1, November 24, 2003 
 */
function IsCFUUID(str) {      
    return REFindNoCase("^[0-9A-F]{8}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{16}$", str);
}

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