最近遇到一個需求,字符串每隔兩位添加一個減號"-",比如網卡物理地址串
使用正則表達式來實現。目前還沒完美實現,但對網卡物理地址串夠用
var regex = /(.{2})/g;
var mac = '1234567890ab'
mac=mac.replace(regex,'$1-')
mac = mac.substr(0,mac.length-1)
console.log(mac);
最近遇到一個需求,字符串每隔兩位添加一個減號"-",比如網卡物理地址串
使用正則表達式來實現。目前還沒完美實現,但對網卡物理地址串夠用
var regex = /(.{2})/g;
var mac = '1234567890ab'
mac=mac.replace(regex,'$1-')
mac = mac.substr(0,mac.length-1)
console.log(mac);
點這個: https://towardsdatascience.com/a-road-map-for-deep-learning-b9aee0b2919f