Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Stripping Characters, mid(), left() ???

Posted on 2004-08-07
4
Medium Priority
?
229 Views
Last Modified: 2013-12-24
Hi,

was wondering, how can I strip part of this string so I am left with the following

Current String: R:\documents\userA\myfile.doc

I want to strip off the R:\documents\ and leave: userA\myfile.doc

Any idea how to do this?

I tried:

<cfset StrippedPath = #left(key,11)#>  In this example key is equal to :  R:\documents\userA\myfile.doc
<cfoutput>#StrippedPath#</cfoutput>

That basically left me with R:\documents\

This is what I want removed, but I want to be able to <cfoutput> what is left AFTER removing R:\documents\

which would be :  userA\myfile.doc

Can anyone help?  The first part of my path is set in stone :  R:\documents\ so I can only work with that, I thought about trying to use right() function, but the right part of my path varies in length, the only set part of the path I can remove is the R:\documents\

Thanks...

-WestSide
0
Comment
Question by:Westside2004
[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
4 Comments
 
LVL 21

Assisted Solution

by:pinaldave
pinaldave earned 300 total points
ID: 11745379
Hi Westside2004,

how about this. ...
<cfset StrippedPath = #RemoveChars(key,1,11)#>  In this example key is equal to :  R:\documents\userA\myfile.doc
<cfoutput>#StrippedPath#</cfoutput>
I am using ...
RemoveChars(string, start, count)

Regards,
---Pinal
0
 
LVL 1

Accepted Solution

by:
jay252 earned 300 total points
ID: 11745393
<cfset key = "R:\documents\userA\myfile.doc">
<cfset StrippedPath = right(key, len(key) - 11)>
<cfoutput>#StrippedPath#</cfoutput>

That should do it. Also you don't need the hash marks in your cfset tag.
0
 
LVL 1

Author Comment

by:Westside2004
ID: 11745657
Thanks.

That did it... appreciate it...

Both answers are correct...

-WestSide
0
 
LVL 21

Expert Comment

by:pinaldave
ID: 11745726
Well Gald to help you,
It is fun!
Regards,
---Pinal
0

Featured Post

Looking for a new Web Host?

Lunarpages' assortment of hosting products and solutions ensure a perfect fit for anyone looking to get their vision or products to market. Our award winning customer support and 30-day money back guarantee show the pride we take in being the industry's premier MSP.

Question has a verified solution.

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

One of the typical problems I have experienced is when you have to move a web server from one hosting site to another. You normally prepare all on the new host, transfer the site, change DNS and cross your fingers hoping all will be ok on new server…
Lease-to-own eliminates the expenditure of hardware replacement and allows you to pay off the server over time. Usually, this is much cheaper than leasing servers. Think of lease-to-own as credit without interest.
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…

618 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