javascript get filename from string -


i want first part of filename full filename, example, from:

bee_gees_-_stayin_alive.mp3 

i want return: bee_gees_-_stayin_alive

how can it?

var filename = file.name; var name = filename.split('.'); var lastarray = name.length; var names = filename.split('.')[lastarray]; 

get index of last period in string , part of string before that.

example:

var fullname = "bee_gees_-_stayin_alive.mp3";  var name = fullname.substr(0, fullname.lastindexof('.')); 

demo: http://jsfiddle.net/sfb2v/


Comments

Popular posts from this blog

google api - Incomplete response from Gmail API threads.list -

Installing Android SQLite Asset Helper -

Qt Creator - Searching files with Locator including folder -