PDA

View Full Version : How to truncate ".jpg" of end of variable string



3dron
November 10th, 2002, 02:55 AM
I create a loadJPG function that auto matically creates an mc.

I want the mc to have the same name as the jpeg without the extension, how can I truncate the ".jpg" off?

jpg = test.jpg

I want mc to = test

Ron

h88
November 10th, 2002, 03:20 AM
This should work:


normal = "h88.jpg";
modified = normal.substring(0, normal.lastIndexOf("."));
DynamicTextField.text = modified;

hope it helps! u just debug this code to suits u!

yours,
--h88

h88
November 10th, 2002, 02:04 PM
It seems that u didnt c my post, ill post that post to notify u 3dRON