|
How
about something like this
=================================================
<cfscript> function
someFunctionName(str) { structName =
StructNew(); parts =
ListToArray(ListFirst(str,"."),"_"); structName.QuestionNumber
= parts[1]; structName.Band =
parts[2]; structName.Sample =
REReplaceNoCase(parts[3],"[^[:digit:]]","","ALL"); structName.Student
= parts[4]; return
structName } </cfscript> <cfdump
var="#someFunction('q1_b34_s1_1234.pdf')#">
==================================================
Names have been changed to protect the
innocent
Steve
Hi All,
I have a quite simple question for
you...
I have a series of file names like
this:
q1_b34_s1_1234.pdf where "q1" represents
"Question 1", "_b34" represents "Band 3/4" and "_s1_1234" represents "Sample
1, student number 1234"
I want to do something like:
<!--- remove the .pdf extension from the file
name ---> <cfset sample_substr = listfirst(attributes.file_name,
".")>
<!--- Get the bit after the _s
---> <cfset sample_substr = listlast(sample_substr,
"_s")>
But "_s" is treated as two different as two
different delimeters in the listlst function.
From the docs:
"Delimeter: A string or a variable that contains one. Character(s) that
separate list elements. Default: comma. If this
parameter contains more than one character, ColdFusion processes each
occurrence of each character as a delimiter; you cannot specify a
multicharacter delimiter."
How could I do a multi character
delimeter?
Is the only option to do a findnocase for the
"_s" and then do mid statements to get the substring?
Thanks
Gav
--- You are currently
subscribed to cfaussie as: [EMAIL PROTECTED] To unsubscribe send a blank
email to [EMAIL PROTECTED] MXDU2004 + Macromedia
DevCon AsiaPac + Sydney, Australia http://www.mxdu.com/ + 24-25 February,
2004
---
You are currently subscribed to cfaussie as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED]
MXDU2004 + Macromedia DevCon AsiaPac + Sydney, Australia
http://www.mxdu.com/ + 24-25 February, 2004
|