Sorry guys, meant for this to go to the list only...



On Thu, June 9, 2005 4:35 pm, Martin Cooper said:
> Nope. If the upload came from a Windows system and the server is running
on *nix, then the system separator is *not* what you want. You'd be
looking for '/' in a path that uses '\' as the separator.

Good point.

OK, so thinking simplistically..

    final char PATH_SEP = File.pathSeparatorChar;
    final char ANTI_PATH_SEP = File.pathSeparatorChar == '/' ? '\\' : '/';
String test = "/sub/dev/test.txt";
    int lastSep;
    lastSep = test.lastIndexOf(PATH_SEP);
    if (lastSep == -1) {
      lastSep = test.lastIndexOf(ANTI_PATH_SEP);
    }

Should do the trick, no?

> Martin Cooper

-- 
Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
http://www.omnytex.com

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to