Solved

String Question

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

Give your grad a cloud of their own!

With up to 8TB of storage, give your favorite graduate their own personal cloud to centralize all their photos, videos and music in one safe place. They can save, sync and share all their stuff, and automatic photo backup helps free up space on their smartphone and tablet.

Question has a verified solution.

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

Suggested Solutions

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…
Introduction This article explores the design of a cache system that can improve the performance of a web site or web application.  The assumption is that the web site has many more “read” operations than “write” operations (this is commonly the ca…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Edureka is one of the fastest growing and most effective online learning sites.  We are here to help you succeed.

911 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

15 Experts available now in Live!

Get 1:1 Help Now