判断两种末尾不同的长字符串,在使用正则表达式的基础上,进一步利用好字符串的方法,最后成功对问题进行解决. package utils import ( "io/ioutil" "os" "regexp" "strings" ) //IsLICENSE return true when file is right LICENSE format while return false when the file is wrong f…
var m ={a:'A'}; if(typeof m == 'object' && JSON.stringify(m).indexOf('{') == 0){//判断变量m是不是json对象 console.log('m is json');} JSON.stringify():这个函数可以将json对象和数组转换为字符串类型. eval():这个方法可以将json字符串和数组字符串转换为json对象和数组对象 eval('('+json_arr_str+'…