From 49569a33d5db283ad3f6a0a7131e5992647aeba3 Mon Sep 17 00:00:00 2001 From: "marcusferl@weifer.de" Date: Wed, 31 Aug 2022 14:25:53 +0200 Subject: [PATCH] Broadcast ready --- src/app/backend/berechnung.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/app/backend/berechnung.ts b/src/app/backend/berechnung.ts index ed3667a..9c9e476 100644 --- a/src/app/backend/berechnung.ts +++ b/src/app/backend/berechnung.ts @@ -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);