How to get a part data from a filename in Java? -


how part of data string:

csvfile = "c:/users//phv/01surname local.csv"  

i need extract surname above string

upd

what think it?

    file f = new file(csvfile);     string[] parts = f.getname().split(" ");     string strparts = new string(parts[0]);      string finfilename = strparts.substring(2, strparts.length()); 

i'm not sure understand question, assume want extract "surname". if that's correct, please try this:

string surname = csvfile.substring(csvfile.lastindexof("/") + 3, csvfile.lastindexof(" ")); 

Comments

Popular posts from this blog

c++ - Creating new partition disk winapi -

Android Prevent Bluetooth Pairing Dialog -

VBA function to include CDATA -