CFLib.org – Common Function Library Project

IsCFUUID(str)

Last updated November 24, 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);
}
blog comments powered by Disqus

Search CFLib.org


Latest Additions

Kevin Cotton added
date2ExcelDate
May 5, 2016

Raymond Camden added
CapFirst
April 25, 2016

Chris Wigginton added
loremIpsum
January 18, 2016

Gary Stanton added
calculateArrival...
November 19, 2015

Sebastiaan Naafs - van Dijk added
getDaysInQuarter
November 13, 2015

Created by Raymond Camden / Design by Justin Johnson