I need a short basename function (one-liner ?) for Javascript:
basename(\"/a/folder/file.a.ext\") -> \"file.a\"
basename(\"/a/folder/file.ext\") -> \"f
if your original string or text file contains single backslash character, you could locate it by using '\'. in my circumstance, i am using javascript to find the index of "\N" from a text file. and str.indexOf('\N'); helped me locate the \N from the original string which is read from the source file. hope it helps.