Search code examples
c#stringnumbersstring-length

C# Number of characters in string with numbers


I have list of strings - sList with numeric values (10,20...) and I want to find out number of it -> 10 returns 2.

I tried sList[i].Length but it didn't work.


Solution

  • If the list is a list of strings then .Length should work. Otherwise you can try this.

    sList[i].ToString().Length