You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
523 B
26 lines
523 B
using System;
|
|
using System.Linq;
|
|
|
|
namespace dotFionn.Checksum.Utils
|
|
{
|
|
public static class Extensions
|
|
{
|
|
public static int DigitSum(this int inInt)
|
|
{
|
|
int digitSum = 0;
|
|
|
|
while (inInt > 0) {
|
|
digitSum += inInt % 10;
|
|
inInt /= 10;
|
|
}
|
|
|
|
return digitSum;
|
|
}
|
|
|
|
public static string[] SplitAllDigits(this string inString)
|
|
{
|
|
return inString.Select(x => x.ToString()).ToArray();
|
|
}
|
|
}
|
|
}
|