0

I am working with images, they all have their sizes mentioned in their name tag.

 http://mysite.com/audio/display%20image/130x130%20jpeg/5755285.jpg

I am getting those is an array of strings. I need to check if the string contains the size 130x130 in it. How can it be done?

1
  • 2
    string.indexOf("130x130") > -1 Commented Jun 28, 2012 at 16:16

1 Answer 1

2
var str = 'http://mysite.com/audio/display%20image/130x130%20jpeg/5755285.jpg';
var search = '130x130';

str.indexOf(search);

If it returns anything but -1 the string has been found:

if (str.indexOf(search) > -1) {
    // Your image contains 130x130
} else {
    // Your image does not contains 130x130
}
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.