Skip to content

Instantly share code, notes, and snippets.

<cfscript>
studentName = "kabeer,Saad,Hamza,Ahmed,Kashif,Mohsin";
foundidx = listFind(studentName, "Kabeer")
writeOutput(foundidx);
if(foundidx == 0){
writeOutput("Nothing is found");
}else{
writeOutput("something is #foundidx# found");
}
<cfscript>
str = "&ge;";
writeDump(decodeforhtml(str)); //outputs ≥
str = "&ge";
writeDump(decodeforhtml(str)); //also outputs ≥
</cfscript>
<cfscript>
str = "&ge";
writeDump(decodeforhtml(str)); //outputs ≥
str = "&ge;";
writeDump(decodeforhtml(str)); //outputs ≥
</cfscript>
<cfscript>
writeoutput("#dateformat(now(),"mm/dd/yyyy")# #timeformat(now(), "hh:mm:ss")#")
</cfscript>
<cfscript>
// Plaintext
plaintext = "Secret message that needs AES encryption.";
// Use raw binary
// AES requires a 16, 24, or 32 byte key (128, 192, 256 bits).
// Here we'll use a 32-byte (256-bit) key for AES-256.
keyBin = BinaryDecode("00112233445566778899AABBCCDDEEFF00112233445566778899AABBCCDDEEFF", "hex");
// Convert to Base64 strings for use with encrypt()
<cfscript>
var content = "1234567890";
var length = 10;
content &= (length lt 100 ? RepeatString("", 100 - length) : "") & chr(13) & chr(10);
writeDump(content);
writeDump(RepeatString("", 100 - length));
</cfscript>
<cfset string1 = " Hello ">
<cfset string2 = " World! ">
<cfset response = string1 & string2>
<cfoutput>#response#</cfoutput>
<cfset a = "">
<cfif isdefined("A")>
yes
<cfelse>
no
</cfif>
<cfset a = "">
<cfif isdefined(a)>
yes
<cfelse>
no
</cfif>
<cfset day1 = "monday">
<cfset day2 = "MONDAY">
<cfif day1 eq day2>
hello
<cfelse>
no
</cfif>