1b. Create an application to demonstrate string operations.

Program:


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Prac1_b
{
 class Program
 {
 static void Main(string[] args)
 {
 string firstname;
 string lastname;
 firstname = "B.N.B";
 lastname = "College";
 firstname += lastname;
System.Console.WriteLine(firstname); 
System.Console.WriteLine(firstname.Substring(2, 1)); System.Console.WriteLine(lastname.Replace("College", "College of Science"));
string columns;
 columns = "C1\tC2\tC3";
 System.Console.WriteLine(columns);
string rows = "R1\r\nR2\r\nR3";
 System.Console.WriteLine(rows);
 string text; text = @"To demonstrate ""string operations""";
System.Console.WriteLine(text);
 Console.ReadKey();
 }
 }
}

Comments