Skip to content

Instantly share code, notes, and snippets.

@bennadel
Created March 25, 2014 12:02
Show Gist options
  • Save bennadel/9760383 to your computer and use it in GitHub Desktop.
Save bennadel/9760383 to your computer and use it in GitHub Desktop.
ColdFusion 9's IsNull() Works On Non-Struct Objects
<cfif (
isStruct( someValue ) &&
!isNull( someValue.someKey )
)>
<!--- Do some conditional logic here... --->
</cfif>
<!--- Create a string value. --->
<cfset myString = "Boo ya!" />
<!--- Check for a property of it. --->
String Key Null: #isNull( myString.someKey )#
<!--- Create a string value. --->
<cfset myString = "Boo ya!" />
<!--- Check for a property of it. --->
String Key Exists: #structKeyExists( myString, "someKey" )#
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment