Game Development Community

A string manipulation problem :-O..

by Jan Sorensen · in Torque Game Engine · 10/15/2010 (4:38 pm) · 3 replies

Hi here :-).

I have a 'string manipulation problem' and hope for help.

I have a 'String' (local %variable) there contain: 'fps/data/shapes/Sprinter/Sprinter.dts'.
I want to remove all the folder information so my variable only contain 'Sprinter.dts' as a result.

I have try many thing, but it's it teases me :-(.

Hope for help, regards Jan :-).

#1
10/15/2010 (5:42 pm)
function getDtsName(%in)
{
   %words = strreplace(%in, "/", " ");
   %fileName = getWord(%words, getWordCount(%words) - 1);
   
   return %fileName;
}

getDtsName("fps/data/shapes/Sprinter/Sprinter.dts");

Fun!!!
#2
10/15/2010 (6:55 pm)
Hi Patrick.

It's works fine, so I say thanks for help and a quick answer.

Jan :-) / :-).
#3
10/15/2010 (6:56 pm)
You're welcome!