Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

javascript get file extension from string

// Use the lastIndexOf method to find the last period in the string, and get the part of the string after that:

var ext = fileName.substr(fileName.lastIndexOf('.') + 1);
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #javascript #file #extension #string
ADD COMMENT
Topic
Name
1+3 =