Skip to main content

C#:Program #11 (String Manipulation)

using System;

namespace String_Manipulation
{
    class Program
    {
        static void Main(string[] args)
        {
            string Text = "  I am random text.";

            Console.WriteLine("Length of the String is {0}",Text.Length);
            Console.WriteLine("Checking that is the word random a part of the Text: {0}", Text.Contains("random"));
            Console.WriteLine("Checking from where the index of word random starts from: {0}", Text.IndexOf("random"));
            Console.WriteLine("Removing the word random from the string: {0}",Text.Remove(7,7));
            Console.WriteLine("Insert some text inside the string: {0}", Text.Insert(7,"not a meaningfull "));
            Console.WriteLine("Replacing word random with no meaningfull text: {0}", Text.Replace("random", "not a meaningfull"));
            Console.WriteLine("Converting the string to only the uppercase: {0}",Text.ToUpper());
            Console.WriteLine("Converting the string to only the lowercase: {0}", Text.ToLower());
            Console.WriteLine("Removing the White spaces: {0}",Text.Trim());

            Console.ReadKey();
        }
    }
}

Comments

Popular posts from this blog