How to remove : in mac address?

#1

Hi all,

how to remove : from the mac: baseElements[1] result , as below :

58:6D:8F:49:42:4E => 586D8F49424E

in the following code :

let i;
let wifiAccessPointsStrings = elements[5].split("&")
let j;
let ap = [];
for (j = 0; j < wifiAccessPointsStrings.length; j++) {
 let baseElements = wifiAccessPointsStrings[j].split("|")
 ap.push({ ssid: baseElements[0], mac: baseElements[1], ["signal-strength"]: baseElements[2] }) // Home|74-DE-2B-44-88-8C|97&Home1|74-DE-2B-44-88-8C|97&Home2|74-DE-2B-44-88-8C|97&Home3|74-DE-2B-44-88-8C|97
}
// adjust baseCountwifiAccessPoints just in case the number actually there didn't match that expexted
LocationRQ.baseCountwifiAccessPoints = ap.length
LocationRQ["access-point"] = ap;

Many thanks!

0 Likes

#2
baseElements[1].replace(/:/g,"")
0 Likes

#3

Thank you knolleary!!

0 Likes