Re: HowTo Convert a String to an Array?
On Thursday 20 May 2010 06:22:14 you wrote: Given the following string in Coldfusion: ul[0][id]=main1 ul[0][children][0][id]=child2 ul[0][children][0][class]= ul[1][id]=main3 ul[2][id]=main4 ul[3][id]=main5 I'm looking for help understanding how to use the string above to create an array, which will then allow be to later build out the following: You probably want to split it on '' to start with. Take a look in the docs at the string functions. -- Tom Chiverton Helping to vitalistically promote prospective m-commerce as part of the IT team of the year 2010, '09 and '08 This email is sent for and on behalf of Halliwells LLP. Halliwells LLP is a limited liability partnership registered in England and Wales under registered number OC307980 whose registered office address is at Halliwells LLP, 3 Hardman Square, Spinningfields, Manchester, M3 3EB. A list of members is available for inspection at the registered office together with a list of those non members who are referred to as partners. We use the word “partner” to refer to a member of the LLP, or an employee or consultant with equivalent standing and qualifications. Regulated by the Solicitors Regulation Authority. CONFIDENTIALITY This email is intended only for the use of the addressee named above and may be confidential or legally privileged. If you are not the addressee you must not read it and must not use any information contained in nor copy it nor inform any person other than Halliwells LLP or the addressee of its existence or contents. If you have received this email in error please delete it and notify Halliwells LLP IT Department on 0870 365 2500. For more information about Halliwells LLP visit www.halliwells.co ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:334222 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: HowTo Convert a String to an Array?
You could try the .split method. Assuming here that the string is in a variable, just use variableName.split() - assuming that is the deliimiter you want to use. Since this uses the .split java method, you can use multiple characters as a delimiter. You can also use a CFLib function which you may find easier to use: http://cflib.org/udf/splitMX hth, larry Given the following string in Coldfusion: ul[0][id]=main1 ul[0][children][0][id]=child2 ul[0][children][0][class]= ul[1][id]=main3 ul[2][id]=main4 ul[3][id]=main5 I'm looking for help understanding how to use the string above to create an array, which will then allow be to later build out the following: UL LI id=main1 Lorem ipsum dolor sit amet, consectetur UL LI id=child2 In hac habitasse platea dictumst. UL/UL /LI /UL /LI LI id=main3 In hac habitasse platea dictumst. UL/UL /LI LI id=main4 In hac habitasse platea dictumst. UL/UL /LI LI id=main5 In hac habitasse platea dictumst. UL/UL /LI /UL Thanks for any help! ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:334242 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
HowTo Convert a String to an Array?
Given the following string in Coldfusion: ul[0][id]=main1 ul[0][children][0][id]=child2 ul[0][children][0][class]= ul[1][id]=main3 ul[2][id]=main4 ul[3][id]=main5 I'm looking for help understanding how to use the string above to create an array, which will then allow be to later build out the following: UL LI id=main1 Lorem ipsum dolor sit amet, consectetur UL LI id=child2 In hac habitasse platea dictumst. UL/UL /LI /UL /LI LI id=main3 In hac habitasse platea dictumst. UL/UL /LI LI id=main4 In hac habitasse platea dictumst. UL/UL /LI LI id=main5 In hac habitasse platea dictumst. UL/UL /LI /UL Thanks for any help! ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:333828 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm