I want to check if a string is a valid file pattern, what i want is:
if string = "/abc/def/apple.xml"
then return TRUE
if string = "/abc/def/"
then return FALSE
if string = "/abc/def"
then return FALSE
My code:
String filepath = "/abc/def/apple.xml";
File f = new File(filepath);
if(f.isFile() && !f.isDirectory())
return true;
else
return false;
With my code i set string as /abc/def/apple.xml
or /abc/def/
, both also return false
, not really sure why