Created
November 12, 2016 08:32
-
-
Save ccwq/88c8dc13495d2be51a97ff2f6b3b2840 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 根据某目录名分割路径 | |
* ex:split_path | |
* @param path 要切割的路径 | |
* @param str1 按照可能存在的目录顺序传入参数 | |
* @param strn | |
* @param ... | |
*/ | |
function split_path(path,str1,strn){ | |
var ret,str, strlist = Array.prototype.slice.call(arguments,1); | |
while(str=strlist.shift()) {ret = path.split(str)[0];} | |
return ret==path?"":ret; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment