actually that's probably stupid, I can just use ListContainsNoCase(fileList, 'Name123', "#Chr(10##Chr(13#")> !
Duncan Cumming IT Manager http://www.alienationdesign.co.uk mailto:[EMAIL PROTECTED] Tel: 0141 575 9700 Fax: 0141 575 9600 Creative solutions in a technical world ---------------------------------------------------------------------- Get your domain names online from: http://www.alienationdomains.co.uk Reseller options available! ---------------------------------------------------------------------- ---------------------------------------------------------------------- [EMAIL PROTECTED] sign.co.uk To: [EMAIL PROTECTED] cc: 07/07/2003 11:21 Subject: [ cf-dev ] list loop backwards Please respond to dev What's the best way to loop backwards through a list? i'm reading in a text file, and turning each line into a list item. got a line that contains a value like Surname123, and I know I need to find Name123 which is a few list items up in the list (could be a variable amount of lines apart). There doesn't seem to be a built-in function (CF 4.5) to loop backwards over the list starting at a given item. I was thinking perhaps something like: <cfset lineNumber1 = ListGetAt(fileList, 'Surname123', '#Chr(10)##Chr(13) #')> <!--- what line number is our start line on? ---> <cfloop index="i" from=lineNumber1 to="1" step="-1"> <!--- loop all the way back to the start if need be ---> <cfif FindNoCase("Name123", ListGetAt(fileList, i, "#Chr(10)##Chr(13) #")> <!--- found the value we're looking for in this line ---> <cfset Name = ListGetAt(fileList, i, "#Chr(10)##Chr(13)#")> <!--- assign to a variable ---> <cfbreak><!--- break out of the loop ---> </cfif> </cfloop> It just seems like there has to be a simpler way of doing this? Duncan Cumming IT Manager http://www.alienationdesign.co.uk mailto:[EMAIL PROTECTED] Tel: 0141 575 9700 Fax: 0141 575 9600 Creative solutions in a technical world ---------------------------------------------------------------------- Get your domain names online from: http://www.alienationdomains.co.uk Reseller options available! ---------------------------------------------------------------------- ---------------------------------------------------------------------- -- ** Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/ To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] For human help, e-mail: [EMAIL PROTECTED] -- ** Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/ To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] For human help, e-mail: [EMAIL PROTECTED]
