Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 2014-12-29
2
Medium Priority
?
102 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
2 Comments
 
LVL 52

Accepted Solution

by:
_agx_ earned 2000 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: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

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

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 …
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 …
Integration Management Part 2
Whether it be Exchange Server Crash Issues, Dirty Shutdown Errors or Failed to mount error, Stellar Phoenix Mailbox Exchange Recovery has always got your back. With the help of its easy to understand user interface and 3 simple steps recovery proced…
Suggested Courses

877 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