count number of characters from left c# code example
Example: count number of characters in an int c#
/// You can do this two ways.
/// First way (below)
public int getcharsforeach(int l) {
int charnum = 0;
foreach (char c in l.ToString()) {
charnum += 1;
}
return charnum;
}
/// Second way (below)
public int getcharlength(int l) {
int letters = l.ToString().Length;
return letters;
}