Example #1
0
        /// <summary>
        /// Returns a string representation padding the leading edge with
        /// zeros if necessary to make up the number of characters
        /// </summary>
        /// <param name="MinimumDigits">The minimum number of digits that the string must contain</param>
        /// <returns>The padded string representation</returns>
        public string ToString(int MinimumDigits)
        {
            string base36Value = Base36.NumberToBase36(numericValue);

            if (base36Value.Length >= MinimumDigits)
            {
                return(base36Value);
            }
            else
            {
                string padding = new string('0', (MinimumDigits - base36Value.Length));
                return(string.Format("{0}{1}", padding, base36Value));
            }
        }
Example #2
0
 /// <summary>
 /// Converts a Base36 alphanumeric string to its <see cref="long">numerical</see> representation.
 /// </summary>
 /// <param name="input"></param>
 /// <returns></returns>
 public static long FromBase36(this string input)
 {
     input = input.ToUpper();
     return(string.IsNullOrEmpty(input) ? 0 : Base36.Base36ToNumber(input));
 }
Example #3
0
 /// <summary>
 /// Returns a string representation of the Base36 number
 /// </summary>
 /// <returns>A string representation</returns>
 public override string ToString()
 {
     return(Base36.NumberToBase36(numericValue));
 }
Example #4
0
 /// <summary>
 /// Converts a <see cref="long" /> number to a Base36 string.
 /// </summary>
 /// <param name="value"></param>
 /// <returns></returns>
 public static string ToBase36(this long value) => Base36.NumberToBase36(value);