Solved

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

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
OpenLDAP set password to expire 7 637
Unable To Access a Web Domain From Our Network 16 86
retrieving files from old server once DNS has changed 10 72
Website being blocked? 3 127
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…
Periodically we have to update or add SSL certificates for customers. Depending upon your hosting plan you may be responsible for the installation and/or key generation. In the wake of Heartbleed many sites were forced to re-key. We will concen…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

831 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