Advertisement

06.07.2008 at 12:08PM PDT, ID: 23466391
[x]
Attachment Details

Substring indexOf lastIndexOf

Asked by newbie_coder in JavaScript, JScript

Tags: Javascript, FireFox

I found lots of tutorials for substring, indexOf, lastIndexOf. But when you throw in slashes and positioning, it's hard to understand how to get the strings from an exact position. Here's my questions.

I would like to retrieve the user name from the following URLs with just a few lines of code:

http://www.flickr.com/photos/username/
http://www.flickr.com/photos/username/2197658314/
http://www.flickr.com/photos/username/2197658176/in/photostream/

Notice it's always "photos/" then the username. How can I use Substring indexOf lastIndexOf to retrieve it?Start Free Trial
[+][-]06.07.2008 at 01:09PM PDT, ID: 21736654

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: JavaScript, JScript
Tags: Javascript, FireFox
Sign Up Now!
Solution Provided By: robacarp
Participating Experts: 1
Solution Grade: A
 
 
[+][-]06.07.2008 at 01:26PM PDT, ID: 21736710

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628