# Remove .jpg from an array

**URL:** <https://forum.kirupa.com/t/remove-jpg-from-an-array/111320>\
**Category:** Uncategorized\
**Created:** [May 25, 2004, 9:10pm UTC](https://forum.kirupa.com/t/remove-jpg-from-an-array/111320 "2004-05-25T21:10:32Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![snaphappy](https://avatars.discourse-cdn.com/v4/letter/s/ed8c4c/32.png) [@snaphappy](https://forum.kirupa.com/u/snaphappy)\
**Post date:** [May 25, 2004, 9:10pm UTC](https://forum.kirupa.com/t/remove-jpg-from-an-array/111320/1 "2004-05-25T21:10:32Z")

</div>

Hi there, I am using the code below to display the amount of images in an array, and the current image.

// show total number of images in the array

\_root.curImage.text = (\_root.image\_array[this.i]);  
\_root.imageTotal.text = “/0”+\_root.image\_array.length;

It appears in a form like this: 024.jpg/060

Is there a quick and easy way to remove the .jpg so it just reads 024/60, have tried looking around but it is a kind of abstract thing to search for and I am still fairly new to arrays

Thanks in advance,

SH

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [May 25, 2004, 10:42pm UTC](https://forum.kirupa.com/t/remove-jpg-from-an-array/111320/2 "2004-05-25T22:42:32Z")

</div>

Look up for the “slice” method (shift+F1 to pop the reference help).

But I’m guessing it’d be easier to take the .jpg out directly out of your array…  
Why don’t you just use numbers for your photos and use something like (cause I guess it’s a loadmovie you’re using…) :

holder.loadmovie(\_root.image\_array[this.i]+".jpg")

Good luck.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [May 26, 2004, 12:23am UTC](https://forum.kirupa.com/t/remove-jpg-from-an-array/111320/3 "2004-05-26T00:23:17Z")

</div>

Cheers Pomme, by flipping over the logic it makes so much more sense.

I used the second method. I had an inkling that you could use slice too from some of the searches - will look it up as I get deeper into arrays.

So took the steps you suggested and it works like a dream and suddenly things make much more sense! Now I don’t need to put .jpg after every image in the text array, and I’m sure this will help me get the back and next buttons working.

Thanks for helping me take the next step, top forum.

SH
