string manipulation

Ask about general coding issues or problems here.

Moderators: egami, macek, gesf

Post Reply

Mon Aug 05, 2002 7:32 am

Code: Select all

$string = 'N:\NML\Perseus\Photographs\procedure pictures\02-08-02\07 Hardware attaching control panel.JPG';
$values = explode("\\",$string);
list($filename) = explode(".",$values[sizeof($values)-1]);
print $filename;

Note that the string being enclosed in single quotes is not accidental or coincedental. I enclosed it in single quotes otherwise it will parse the '\' as a special character and the script won't work. The rest should be fairly self explanatory.

Post Reply