Last active
April 11, 2016 12:30
-
-
Save roryl/2433bba8846d72eabda7db04ad4147a0 to your computer and use it in GitHub Desktop.
Lucee List Examples
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<cfscript> | |
myList = "one,two,three"; //Create a comma separated list | |
echo(myList.listLen() & "<br />"); //echo the length, should be 3 | |
myOtherList = "one|two|three"; //Create a pipe separated list | |
echo(myOtherList.listLen("|") & "<br />"); //Echo the length, should be three. Pass the delimiter because we are overriding the default which was a comma | |
echo(myList.listLen("t")); //Any character can be a delimiter | |
</cfscript> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<cfscript> | |
myList = "one,two,three"; | |
for(val in myList){ | |
echo(val & "<br />"); | |
} | |
</cfscript> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<cfscript> | |
myList = "one|two|three"; | |
for(val in myList.listChangeDelims("," , "|")){ | |
echo(val & "<br />"); | |
} | |
</cfscript> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<cfscript> | |
myList = "one,two,three"; | |
myArray = myList.listToArray(); | |
for(val in myArray){ | |
echo(val & "<br />"); | |
} | |
</cfscript> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* My xUnit Test | |
*/ | |
component extends="testbox.system.BaseSpec"{ | |
/*********************************** LIFE CYCLE Methods ***********************************/ | |
// executes before all test cases | |
function beforeTests(){ | |
} | |
// executes after all test cases | |
function afterTests(){ | |
} | |
// executes before every test case | |
function setup( currentMethod ){ | |
} | |
// executes after every test case | |
function teardown( currentMethod ){ | |
} | |
/*********************************** TEST CASES BELOW ***********************************/ | |
// Remember that test cases MUST start or end with the keyword 'test' | |
function checkAllSyntaxTest(){ | |
var files = directoryList(""); | |
for(file IN files){ | |
if(file CONTAINS ".cfm"){ | |
include template="#getFileFromPath(file)#"; | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment