Broadcast ready

This commit is contained in:
marcusferl@weifer.de 2022-08-31 14:25:53 +02:00
parent dc5af6085e
commit 49569a33d5

View File

@ -15,18 +15,18 @@ export class Berechnung {
}
this.binArr.push(tmp);
});
return this.binArr.join(".")
return this.binArr.join(" ")
}
binToDec(bin: string) {
var arr = bin.split(" ")
alert(arr)
let binNum = ""
for (let index = 0; index < arr.length; index++) {
binNum += parseInt(arr[index], 2).toString();
for (let index = 0; index < arr.length - 1; index++) {
binNum += parseInt(arr[index], 2).toString() + ".";
}
return binNum;
return binNum.slice(0, -1);
}
@ -36,7 +36,7 @@ export class Berechnung {
}
broadCastBin(binIp: string, prefix: number) {
var arr = binIp.split('.');
var arr = binIp.split(' ');
let prefixIp = arr.join("");
let hostbin = prefixIp.slice(0, prefix);
hostbin = hostbin + "1".repeat(32 - prefix);