Solved

Coldfusion split string

Posted on 2012-03-17
5
581 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
  • 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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

PROBLEM: How to add your own buttons to the bottom toolbar with paging info ( result count ). While creating a cfgrid, I ran into an issue where I wanted to embed my own custom buttons where the default ones ( insert / delete / etc… ) are for aes…
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…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

705 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

19 Experts available now in Live!

Get 1:1 Help Now