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

x
?
Solved

Coldfusion split string

Posted on 2012-03-17
5
Medium Priority
?
605 Views
Last Modified: 2012-03-17
hello experts i need help to split a string
My url string is like:
http://www.test1.com/showimage.cfm?imageurl=http://www.test2.com/image?id=1234&group=5678

looking for url.imageurl i will get:http://www.test2.com/image?id=1234
So i think i need to split the string to get only the second part (after "imageurl="):
http://www.test2.com/image?id=1234&group=5678

Any help?
0
Comment
Question by:Panos
[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
  • 3
  • 2
5 Comments
 
LVL 39

Expert Comment

by:gdemaria
ID: 37732798
<cfset theURL = "http://www.test1.com/showimage.cfm?imageurl=http://www.test2.com/image?id=1234&group=5678">

If you feel that there will only be one query string parameter on this url, then you can grab it easily by looking for the equals sign...

<cfset imageURL = listLast(theURL,"=")>

Note that if you try to use this full address as a link, you will have trouble unless you escape it.. there are two ?s and the &group will be considered a second parameter, not part of imageURL

http://www.test1.com/showimage.cfm?imageurl=http://www.test2.com/image?id=1234&group=5678
0
 
LVL 2

Author Comment

by:Panos
ID: 37732827
Hi gdemaria.
I need to grab in this case  this:
http://www.test2.com/image?id=1234&group=5678
(it could be :
http://www.test1.com/showimage.cfm?imageurl=http://www.test2.com/image/blablabla.jpg. in this case  i need :http://www.test2.com/image/blablabla.jpg)

generally i need to grad all the text next to imageurl=
listlast doesn't work
0
 
LVL 39

Accepted Solution

by:
gdemaria earned 2000 total points
ID: 37732836
Sorry, it should have been listRest(theURL,"=") , not listLast.
0
 
LVL 2

Author Comment

by:Panos
ID: 37732855
Yes.
This is working
0
 
LVL 2

Author Closing Comment

by:Panos
ID: 37732858
thank you
regards
panos
0

Featured Post

[Webinar] Lessons on Recovering from Petya

Skyport is working hard to help customers recover from recent attacks, like the Petya worm. This work has brought to light some important lessons. New malware attacks like this can take down your entire environment. Learn from others mistakes on how to prevent Petya like worms.

Question has a verified solution.

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

I spent nearly three days trying to figure out how incorporate OAuth in Coldfusion for the Eventful API. Hopefully, this article will allow Coldfusion Programmers to buzz through the API when they need to. Basically, what this script does is authori…
Recently while working on a project I got a very annoying cfdocument has no body error message. I had never seen this error before. So I checked the code. The code was pretty simple; it was Just showing me the cfdocumnt tag and inside that tag a …
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …

670 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