Solved

How can I remove a list of items after found item?

Posted on 2014-12-29
2
87 Views
Last Modified: 2014-12-30
Hello,

I would like to be able to remove a list of items after another found list item.

A example list item could be : "3000-SE-Pine-St-Seattle-WA-99200"

I wanted to be able to capture everything before "Seattle" but I was thinking a second list could be used to delete everything after any matched 2nd list items.

<cfset streetTypeSuffix = "dr,st,lk,rd,ave,ln,way,ct,loop,blvd,hwy,cir">

So expected results would be... "3000-SE-Pine-St"

Problem is if Seattle is a two word city so I can't always just use "listDeleteAt" @ positions 1,2 & 3 but I do know the values in "streetTypeSuffix" list.
0
Comment
Question by:brihol44
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 52

Accepted Solution

by:
_agx_ earned 500 total points
ID: 40523750
Unfortunately, CF doesn't have much in the way of "sub list" functions. So you have to loop in order to reconstruct the list. Another option is to try a regex like:

<cfset text = "3000-SE-Pine-Blah-Seattle-WA-99200">
<cfset newText = reReplaceNoCase(text, "\-(dr|st|lk|rd|ave|ln|way|ct|loop|blvd|hwy|cir)\-.+$", "-\1")>
<cfdump var="#newText#">

Open in new window

0
 

Author Closing Comment

by:brihol44
ID: 40523995
Nice AGX! Thx, works.
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Coldfusion Error: The toString method was not found 5 79
Fixing Old Legacy Code 1 45
Insert query into temp tables using Coldfusion 3 44
Coldfusion builder and IIS 2 19
PROBLEM:  How to open a cfwindow or run a function on double click of a cfgrid row. One of my clients wanted to be able to double click on a row item to get more detailed information about a transaction and to be able to modify the line items i…
I spent nearly three days trying to figure out how incorporate OAuth in Coldfusion for the Eventful API. Hopefully, this article will allow Coldfusion Programmers to buzz through the API when they need to. Basically, what this script does is authori…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

756 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