Solved

String Question

Posted on 2004-08-19
14
149 Views
Last Modified: 2013-12-24
I am trying to Parse this string to get everything before the \

Online%20Tools%20and%20Industry%20Sites\Useful%20Tools

would return Useful%20Tools
0
Comment
Question by:JoshDale
14 Comments
 
LVL 21

Expert Comment

by:pinaldave
ID: 11846443
Hi JoshDale,
listlast(yourstring,"\")
will do ... if not then just escape it with one more
 
listlast(yourstring,"\\")
Regards,
---Pinal
0
 

Author Comment

by:JoshDale
ID: 11846450
I figured it out. If anyone needs to know how to do this here it is.

<cfset name = Right('YourStringGoesHere', FindOneOf('StringToFind', reverse(URL.path)) - 1)>

For Example:
<cfset name = Right('MyForm.xml', FindOneOf('.', reverse(URL.path)) - 1)>
<cfoutput>#name#</cfoutput>

Would output xml.

If you take off the - 1 it would output .xml

0
 
LVL 21

Expert Comment

by:pinaldave
ID: 11846632
that is nice trick. Thanks:)
0
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.

 

Author Comment

by:JoshDale
ID: 11846699
Like that? Did it myself. I'm starting to like ColdFusion.
0
 
LVL 21

Expert Comment

by:pinaldave
ID: 11846707
I really liked it... I perticularly like the usage of findoneof. I just need to use it but i managed with listlast. I will try to use that, for fun. It is always good tolearn.
Regards,
---Pinal
0
 
LVL 17

Expert Comment

by:Tacobell777
ID: 11848666
JoshDale, what you are doing is a bad idea, and not the way to go about doing it.
Pinaldaves solution was the solution.

<cfset myResult = listlast(yourstring,"\")>

Not sure why he would want to escape the backslash though?

0
 

Author Comment

by:JoshDale
ID: 11851602
yea, it work at getting me the extension name, but what I want was the name without the extension. There is no significant performance hit with how I did it. So I think I will just leave it.
0
 
LVL 35

Expert Comment

by:mrichmon
ID: 11853677
Please post a question here asking to have this question PAQ since you solved yourself :

http://www.experts-exchange.com/Community_Support/
0
 
LVL 17

Expert Comment

by:anandkp
ID: 11869549
its ur call - but i think ... doing it the way it was suggested wld be a better option [agree with pinal & tacobell]
thou if u just want the name without the extension u cld just do

#ListFirst(ListLast(yourstring,"\"),".")#
0
 

Author Comment

by:JoshDale
ID: 11870646
Yea, but the only problem with that is I have alot of filenames with more than one . for example myfile.test.text
0
 

Author Comment

by:JoshDale
ID: 12075048
I found my own solution.
0
 

Accepted Solution

by:
modulo earned 0 total points
ID: 12230022
PAQed, with points refunded (500)

modulo
Community Support Moderator
0

Featured Post

Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
LAMP problem identifier tool ? 9 118
Intranet and Kerberos Authentication (not sharepoint!) 8 133
Systems talking to each other 5 130
exchange 2010 turning off 3des ciphers 2 194
If you don't have the right permissions set for your WordPress location in IIS, you won't be able to perform automatic updates. Here's how to fix the problem.
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 …
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.
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…

770 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