CFLib.org – Common Function Library Project

string2List(s[, delim])

Last updated May 26, 2005

author

Joshua Miller

Version: 1 | Requires: CF5 | Library: StrLib

Description:
Converts a string to a list using the specified delimter (defaults to comma). Returns a list.

Return Values:
Returns a string.

Example:

<cfoutput>
#string2List("ABCDEFGHIJKLMNOPQRSTUVWXYZ")#
</cfoutput>

Parameters:

Name Description Required
s String to modify. Yes
delim Delimiter to use for new list. Defaults to a comma. No

Full UDF Source:

/**
 * Converts a string to a list using the specified delimter (defaults to comma). Returns a list.
 * 
 * @param s 	 String to modify. (Required)
 * @param delim 	 Delimiter to use for new list. Defaults to a comma. (Optional)
 * @return Returns a string. 
 * @author Joshua Miller (josh@joshuasmiller.com) 
 * @version 1, May 26, 2005 
 */
function string2List(s){
	var i=0;
	var l="";
	var delim=",";
	
	if(arrayLen(arguments) gt 2) delim = arguments[3];
	
	for(i=1;i lte Len(s);i=i+1) l = listAppend(l,mid(s,i,1),delim);

	return l;
}
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