private static Int64 ConstructNumberFromChars()

in csharp/EPAM.Deltix.HdTime/Formatter.cs [382:398]


		private static Int64 ConstructNumberFromChars(String source, Int32 offset, Int32 length, Int32 expectedLength)
		{
			Int64 result = 0;

			Int32 coefficient = Pow(10, expectedLength - 1);
			for (Int32 index = offset; index < offset + length; index++)
			{
				Debug.Assert(source.Length > index, "Index is out of range.");
				Char digit = source[index];
				result += ConvertCharToInt32(digit) * coefficient;

				Debug.Assert(coefficient != 0);
				coefficient /= 10;
			}

			return result;
		}