P
P
Parsifal1122020-10-17 19:38:47
C++ / C#
Parsifal112, 2020-10-17 19:38:47

How to check if a string starts with a space c#?

using System;
using System.Security.Cryptography;

namespace lab4
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("Введiть 3 будь-якi рядки");
            String r1 = Console.ReadLine();
            String r2 = Console.ReadLine();
            String r3 = Console.ReadLine();
             StartsWith( r1, -);

        }
    }
}

Answer the question

In order to leave comments, you need to log in

3 answer(s)
B
Boris the Animal, 2020-10-17
@Casper-SC

string text = "   ssd";
if (text.StartsWith(" "))
{
}

V
Vladimir Korotenko, 2020-10-17
@firedragon

if(r1[0]==" ")
Something like this, however, there is https://docs.microsoft.com/ru-ru/dotnet/api/system...

Z
zed220, 2020-10-17
@zed220

if(text?.StartsWith(" ") == true) {
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question