首页 > 其他 > 详细

以绅士的风范每隔四位插入一个空格

时间:2019-10-19 12:13:24      阅读:49      评论:0      收藏:0      [点我收藏+]
function insertSpacesIntoString( s, defVal ) {
 return s && (function( s ) {
  return s.length > 4 && (s
   .replace(/\s/g,‘‘)
   .replace(/(.{4})/g,‘$1 ‘))
   .replace(/(\s*$)/g,‘‘)
   || s
  ;
 }(s.toString())) || defVal || ‘‘;
}

 

以绅士的风范每隔四位插入一个空格

原文:https://www.cnblogs.com/houkaihua/p/11703352.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!