Solved

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

Posted on 2014-12-29
2
95 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

This article  is about submitting  form through  ColdFusion.Ajax.submitForm to the action page and send a response back in JSON format which later can be decoded using ColdFusion.JSON.decode. By this way you can avoid the usual page refresh for subm…
Hi, Even though I have created this Tutorial on My personal Blog, Some people might not able to find my website, So here i am posting it again Today, from the topic it is very clear that i will be showing you here the very basic usage of how we …
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…

636 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