Solved

String Question

Posted on 2004-08-19
14
157 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

 

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

Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

Question has a verified solution.

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

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…
Lease-to-own eliminates the expenditure of hardware replacement and allows you to pay off the server over time. Usually, this is much cheaper than leasing servers. Think of lease-to-own as credit without interest.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

762 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