Solved

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

Posted on 2014-12-29
2
88 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: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying 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

Suggested Solutions

Title # Comments Views Activity
COLD FUSION 6 35
Using a variable with dateAdd 18 81
cfscript coding help 4 40
Coldfusion builder and IIS 2 39
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…
Hi. There are several upload tutorials using jquery and coldfusion. I found a very interesting one here Upload Your Files using Jquery & ColdFusion and Preview them (http://www.randhawaworld.com/) . I did keep the main js functions but made sever…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

739 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