Solved

Parse a string with coldfusion

Posted on 2010-09-23
2
371 Views
Last Modified: 2012-05-10
I have a http post that will return a string like the example below.
I need to get the value of qualified.

The string will not always be in same exact character length.
How do i search string for [qualified] => then set the value to result.

<cfset result =

Array ( [success] => 1 [leadID] => 8001640 [qualified] => 1 )
0
Comment
Question by:LeadCo
2 Comments
 
LVL 52

Accepted Solution

by:
_agx_ earned 500 total points
ID: 33750678
<cfset result = "">
<cfset str = "Array ( [success] => 1 [leadID] => 8001640 [qualified] => 1 ) ">
<cfset matches = reMatchNoCase("(\[qualified\]\s+=>\s+[^\[\)]+)", str)>
<!--- if found --->
<cfif arrayLen(matches)>
      <cfset result = listLast(matches[1], "=>")>
</cfif>
<cfoutput> result = #result# </cfoutput>
0
 

Author Closing Comment

by:LeadCo
ID: 33938939
Thanks
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

The technique is by far very Simple! How we can export the ColdFusion query results to DOC file?  Well before writing this I researched a lot in Internet but did not found a good Answer anyways!  So i thought now i should share my small snippet w…
Sometimes databases have MILLIONS of records and we need a way to quickly query that table to return the results me need. Sure you could use CFQUERY but it takes too long when there are millions of records. That is why SOLR was invented. Please …
This video discusses moving either the default database or any database to a new volume.
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now