Solved

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

Posted on 2004-08-07
4
206 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
  • 2
4 Comments
 
LVL 21

Assisted Solution

by:pinaldave
pinaldave earned 75 total points
Comment Utility
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
Comment Utility
<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
Comment Utility
Thanks.

That did it... appreciate it...

Both answers are correct...

-WestSide
0
 
LVL 21

Expert Comment

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

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Article by: kevp75
Hey folks, 'bout time for me to come around with a little tip. Thanks to IIS 7.5 Extensions and Microsoft (well... really Windows 8, and IIS 8 I guess...), we can now prime our Application Pools, when IIS starts. Now, though it would be nice t…
Meet the world's only “Transparent Cloud™” from Superb Internet Corporation. Now, you can experience firsthand a cloud platform that consistently outperforms Amazon Web Services (AWS), IBM’s Softlayer, and Microsoft’s Azure when it comes to CPU and …
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

744 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

11 Experts available now in Live!

Get 1:1 Help Now