/**
* 字符串是否含有html标签的判断
* Whether the string contains an html tag
* @param htmlStr
*/
function isHtmTagl(htmlStr) {
var reg = /<[^>]+>/g;
return reg.test(htmlStr);
}
/**
* 字符串是否为JSON对象的判断
* Whether the string is a JSON object
* @param jsonStr
*/
function isJSON(jsonStr) {
if (typeof jsonStr== 'string') {
try {
var obj = JSON.parse(jsonStr);
if (typeof obj == 'object' && obj) {
return true;
} else {
return false;
}
} catch (e) {
console.log('error:' + jsonStr+ '!!!' + e);
return false;
}
}
console.log('It is not a string!')
}