[Tutor] I need help slicing.

SA sarmstrong13@mac.com
Fri, 12 Jul 2002 13:16:18 -0500


How do you slice a string from rear to front that is variable length?

For example:

I have two strings -
    test.html
    test.txt

I would like to compare each string individually and do a conditional
statement that says how to handle the file. In other words, I would like my
script to individually discern between the .txt file and the .html file and
handle each file differently based upon it's file extension.


Would this be better hadled with re or string slicing?


On another note, say it has a directory in front of the file, I would like
the script to look at the directory name and decide whether it is ok or not
to continue on working on this file.

These questions are both related to cgi security for a cgi script I'm
working on.

Thanks in Advance.
SA


-- 
"I can do everything on my Mac I used to on my PC. Plus a lot more ..."
-Me