Solved

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

Posted on 2004-08-07
4
215 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 75 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 75 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

Save the day with this special offer from ATEN!

Save 30% on the CV211 using promo code EXPERTS30 now through April 30th. The ATEN CV211 connects a laptop directly to any server allowing you instant access to perform data maintenance and local operations, for quick troubleshooting, updating, service and repair.

Question has a verified solution.

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

In our day to day coding, how many times have we come across a necessity to check whether a URL is a broken link or not? For those of you that answered countless and are using ColdFusion like myself, then this article is for you.  It will show yo…
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…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

730 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