private static List <string> SplitIntoNibbles(string binaryString) { binaryString = SeparatorService.RemoveSeparatorBlanks(binaryString); binaryString = BinaryService.AddZerosToFillHighestNibbleWithZeros(binaryString); binaryString = SeparatorService.AddSeparatorBlanks(binaryString, 4); return(binaryString.Split(" ") .Reverse() .ToList()); }
public static string ConvertToDecimal(string hexadecimalString) { if (hexadecimalString.IsNullOrWhiteSpace()) { return(string.Empty); } InvalidCharactersExceptionService.ThrowIfRegexMatches(hexadecimalString, InvalidCharacterRegexFor.Hexadecimal, "Only 0-9, A-F and whitespace allowed. Contains not allowed characters:"); hexadecimalString = SeparatorService.RemoveSeparatorBlanks(hexadecimalString); var decimalString = ConvertBaseToBaseService.ConvertFromBaseToBase(hexadecimalString, NumberBase.Hexadecimal, NumberBase.Decimal); return(SeparatorService.AddSeparatorBlanks(decimalString, 3)); }
public void Update_number_format(string oldFormattedNumber, string expectedNumberFormat) { var result = SeparatorService.RemoveAndAddSeparatorBlanks(oldFormattedNumber, 4); result.Should().Be(expectedNumberFormat); }