Solved

Coldfusion split string

Posted on 2012-03-17
5
599 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 500 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

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

Suggested Solutions

CFGRID Custom Functionality Series -  Part 1 Hi Guys, I was once asked how it is possible to to add a hyperlink in the cfgrid and open the window to show the data. Now this is quite simple, I have to use the EXT JS library for this and I achiev…
Hi. There are several upload tutorials using jquery and coldfusion. I found a very interesting one here Upload Your Files using Jquery & ColdFusion and Preview them (http://www.randhawaworld.com/) . I did keep the main js functions but made sever…
This video shows how to use Hyena, from SystemTools Software, to update 100 user accounts from an external text file. View in 1080p for best video quality.

752 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