Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

String Question

Posted on 2004-08-19
14
Medium Priority
?
166 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
Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

 

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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

This is a guide to setting up a new WHM/cPanel Server to be used for web hosting accounts. It is intended for web hosting company administrators and dedicated server owners. For under $99 per month (considering normal rate of Big Data Cetnters like …
Article by: kevp75
Hey folks, 'bout time for me to come around with a little tip. Thanks to IIS 7.5 Extensions and Microsoft (well... really Windows 8, and IIS 8 I guess...), we can now prime our Application Pools, when IIS starts. Now, though it would be nice t…
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…

660 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