Solved

String Question

Posted on 2004-08-19
14
130 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
 

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
What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

 

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

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

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.
When it comes to showing a 404 error page to your visitors, you do not want that generic page to show, and you especially do not want your hosting provider’s ad error page to show either. In this article, I will show you how to enable the custom 40…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
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…

706 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

22 Experts available now in Live!

Get 1:1 Help Now