微信小程序数组,字符串操作

数组

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

你可能感兴趣的:(微信小程序数组,字符串操作)