数组
1.数组排序
https://www.jianshu.com/p/2aa3ca279646
2.倒序
// var resutList =[];
resutList.reverse();
字符串
1.根据字符分割
let aaa = [];
let bbb = 'dddd,aaaa';
aaa = bbb.split(',');
console.log('00000000000'+aaa);
2.类型转换
https://blog.csdn.net/shanshan_1117/article/details/89371296
var data = '123.524'
var data_s = ''
/*parseInt 字符串 转数字 */
data_s = parseInt(data)
/*获取几位小数*/
(data_s).toPrecision(2) 数字
(data_s).toFixed(2) 字符串
//转number类型
Number(aa)
区分字母数字
var value = 'ssssa12133123131QQQ上市'
var lockID = value.toLocaleLowerCase();
let arrStr = [];
arrStr = lockID.split('');
//
for(var i = 0; i<arrStr.length;i++){
var aa = lockID.charCodeAt(i);
if( (48<=aa&&aa<=57)||(97<=aa&&aa<=122) ){//小写字母和数字
// 48-57是数字,65-90是大写字母,97-122是小写字母,别的都算成文字
// console.log('**'+String(aa));
that.setData({
carLockId:lockID,
});
console.log(lockID);
}else{
wx.showToast({
title: '有误,请重新',
icon: 'none',
duration: 2000,
})
return;
}
}