CFLib.org – Common Function Library Project

IsMSSQLGUID(str)

Last updated October 3, 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);

}
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