Rama Krishna Rama Krishna - 1 month ago 5x
Android Question

Regular expression for song name in android

In my application i want to display song name.But now it will be showing total song path,like this

String song_name = /storage/Music/Lean on.mp3

but i want to display only song name. that means

String song_name = Lean on.mp3

Can any one help me that what is the regular expressions used for extracting song name for total file path.

Any help could be appreciated thanks in Advance.


You can use subString function with combination of LastInedexOf function. please find below example

String path=":/storage/Music/Lean on.mp3";
String filename=path.substring(path.lastIndexOf("/")+1);