parseINI(codefile)
Last updated April 15, 2011
Version: 1 | Requires: CF8 | Library: CFMLLib
Description:
parseINI parses an INI file into a structure that contains sections and keys as structures.
Return Values:
Returns a struct.
Example:
<cfscript>
inifile = 'C:/myboot.ini';
inistruct = parseINI(inifile);
writeDump(inistruct);
</cfscript>
Parameters:
Name | Description | Required |
---|---|---|
codefile | FIle to read. | Yes |
Full UDF Source:
/**
* Parses an INI file into a structure.
*
* @param codefile FIle to read. (Required)
* @return Returns a struct.
* @author Dave Long (dave@davejlong.com)
* @version 1, April 14, 2011
*/
function parseINI(string codefile) {
var i = '';
var codes = structNew();
local.sections = getProfileSections(arguments.codefile);
for(local.section IN local.sections){
codes[local.section] = structNew();
local.keys = local.sections[local.section];
for(i=1;i LTE listLen(local.keys);i++){
codes[local.section][listGetAt(local.keys,i)] = getProfileString(arguments.codefile,local.section,listGetAt(local.keys,i));
}
}
return codes;
}
Search CFLib.org
Latest Additions
Raymond Camden added
QueryDeleteRows
November 04, 2017
Leigh added
nullPad
May 11, 2016
Raymond Camden added
stripHTML
May 10, 2016
Kevin Cotton added
date2ExcelDate
May 05, 2016
Raymond Camden added
CapFirst
April 25, 2016