Coldfsuion help

Posted on 2012-08-31
Last Modified: 2012-08-31
I have a string \content\10\home\test\test.html but in need to display

How can this be done
Question by:erikTsomik
    LVL 51

    Accepted Solution

    If it's always "\content\10\" you want to remove:

              <cfset newString = replace(origString, "\content\10\", "\")>   ... OR
              <cfset newString = reReplace(origString, "^(\\content\\10\\)", "\")>  

    If it's the first 2 directories  ie \{first}\{second}\home\test\test.html :

            <cfset newString = "\"& listRest(listRest(origString, "\"), "\")>

    Edit, or possibly:        

            <cfset newString = reReplace( origString, "^(\\[^\\]+){2}, "")>
    LVL 19

    Author Comment

    it works but I was wrong I need to display home\test\test.html instead of \home\test\test.html. So no leading slash
    LVL 51

    Expert Comment

    Just remove the inserted "\" then

        <cfset newString = replace(origString, "\content\10\", "")>   ... OR
        <cfset newString = reReplace(origString, "^(\\content\\10\\)", "")>   ... OR
        <cfset newString = listRest(listRest(origString, "\"), "\")>

    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    Join & Write a Comment

    Introduction This article explores the design of a cache system that can improve the performance of a web site or web application.  The assumption is that the web site has many more “read” operations than “write” operations (this is commonly the ca…
    Introduction Since I wrote the original article about Handling Date and Time in PHP and MySQL ( several years ago, it seemed like now was a good time to updat…
    Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
    Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…

    729 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