Languages
[Edit]
EN

C# / .NET - how to check string length?

0 points
Created by:
Zeeshan-Peel
850

In C# it is possible to check string length in the following way.

String Length property example

using System;

public class Program
{
    public static void Main(string[] args)
    {
        string text = "This is my text...";
        string anotherText = "Another text...";

        Console.WriteLine( text.Length );        // 18
        Console.WriteLine( anotherText.Length ); // 15 
    }
}

Output:

18
15
Donate to Dirask
Our content is created by volunteers - like Wikipedia. If you think, the things we do are good, donate us. Thanks!
Join to our subscribers to be up to date with content, news and offers.

C# / .NET - String (popular problems)

C# / .NET - check string length
Native Advertising
🚀
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - we help you to
solve coding problems.
Ask question.

❤️💻 🙂

Join