1.0.0 • Published 2 years ago

student-han v1.0.0

Weekly downloads
-
License
ISC
Repository
-
Last release
2 years ago

##安装

npm install student-han

##导入

const student = require('student-han')

##格式化时间

// 调用时间
const str = student.dateformat(new Date())
// 输出结果
console.log(str);

##转义HTML特殊字符

// 测试一个字符串并接受到htmlStr
const htmlStr = '<h1 style:"color: red">这是一个测试<span>字符串<span></h1>';

// 调用htmlescape来测试
const htstr = student.htmlescape(htmlStr);

// 输出结果
console.log(htstr);

##还原HTML特殊字符

// 测试一段特殊的字符串
const ahtstr = '&lth1 style:&quotcolor: red&quot&gt这是一个测试&ltspan&gt字符串&ltspan&gt&lt/h1&gt'
// 根据上一个测试的结果反向测试
const unhtstr = student.htmlunescape(ahtstr);

// 输出结果
console.log(unhtstr);

##开源协议 ISC