[Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 669
  • Last Modified:

Coldfsuion help

I have a string \content\10\home\test\test.html but in need to display
\home\test\test.html


How can this be done
0
erikTsomik
Asked:
erikTsomik
  • 2
1 Solution
 
_agx_Commented:
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}, "")>
0
 
erikTsomikSystem Architect, CF programmer Author Commented:
it works but I was wrong I need to display home\test\test.html instead of \home\test\test.html. So no leading slash
0
 
_agx_Commented:
Just remove the inserted "\" then

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

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now