Here in this post I have given an example that shows how to check the availability of a word in a given sentence using C#

using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

using System.Globalization;

namespace CheckAvailability

{

class Program

{

static void Main(string[] args)

{

string data = "Prahalad is the king of Programming ";

Console.WriteLine("{0}\n\n",data);

Console.WriteLine("Enter a word to check the availability from the above sentence\n");

string get = Console.ReadLine();

bool result = data.Contains(get);

if (result == true)

{

Console.WriteLine("Data {0} is available",get);

}

else

Console.WriteLine("Data {0} is not available",get);

Console.Read();

}

}

}


Screenshot:

Availability.png


Please feel free to comment if any suggestion

Thank you..