我想摘取一条绝对道路的名称。 如果我有价值/mnt/sdcard/Videos/Videoname的画面,我就想节省一个带有价值视频名称的画面。
扼杀正在发生变化,我可以事先获得鞭.的数量。 我怎么能够从最后的争 the中分出一线?
/mnt/sdcard/Videos/Videoname -> Videnoname
我想摘取一条绝对道路的名称。 如果我有价值/mnt/sdcard/Videos/Videoname的画面,我就想节省一个带有价值视频名称的画面。
扼杀正在发生变化,我可以事先获得鞭.的数量。 我怎么能够从最后的争 the中分出一线?
/mnt/sdcard/Videos/Videoname -> Videnoname
页: 1 文件:
归还这一抽象道路名称所标明的档案或目录名称。 这只是姓名顺序上的最后名字。 如果路名的顺序是空的,那么空洞就会回去。
例:
String name = new File("/mnt/sdcard/Videos/Videoname").getName();
如果您来自“File”物体,你可以采用以下方法:
String fileName = myFile.getName();
如果你从简单的角度来看待,你可以使用。
String fileName = myString.substring(myString.lastIndexOf("/")+1);
String path = "/mnt/sdcard/Videos/Videoname"; // Your path
String fileName = new File(path).getName(); // you file name
最容易的方式
String path ="AnyDirectory/subFolder/last.htm";
int pos = path.lastIndexOf("/") + 1;
path.substring(pos, path.length()-pos);
现在,你在路上是最后的。
但是,如果再作一些研究,以下法典则发挥作用......
String[] Tokens = stringPath.split("\\");
你们需要两次逃脱“”。
string a = "/foo/bar/target";
string words = a.Split("/")
string target = words[words.length-1]
Hi have this j2ee web application developed using spring framework. I have a problem with rendering mnessages in nihongo characters from the properties file. I tried converting the file to ascii using ...
Check this, List<String> list = new ArrayList<String>(); for (int i = 0; i < 10000; i++) { String value = (""+UUID.randomUUID().getLeastSignificantBits()).substring(3, ...
I am in the middle of solving a problem where I think it s best suited for a decorator and a state pattern. The high level setting is something like a sandwich maker and dispenser, where I have a set ...
I have been trying to execute a MS SQL Server stored procedure via JDBC today and have been unsuccessful thus far. The stored procedure has 1 input and 1 output parameter. With every combination I ...
I have a system which contains multiple applications connected together using JMS and Spring Integration. Messages get sent along a chain of applications. [App A] -> [App B] -> [App C] We set a ...
If I m given two Java Libraries in Jar format, 1 having no bells and whistles, and the other having lots of them that will mostly go unused.... my question is: How will the larger, mostly unused ...
I have a Class variable that holds a certain type and I need to get a variable that holds the corresponding array class. The best I could come up with is this: Class arrayOfFooClass = java.lang....
I m working on a Java desktop application that reads and writes from/to different files. I think a better solution would be to replace the file system by a SQLite database. How hard is it to migrate ...