Saturday, May 5, 2012

String Manipulation

String is immutable
String Builder is mutable





using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace Examples
{
    public partial class @string : Form
    {
        public @string()
        {
            InitializeComponent();
        }

        private void @string_Load(object sender, EventArgs e)
        {
            StringBuilder sb = new StringBuilder();
            sb.Append(" World ");
            MessageBox.Show(sb.ToString());
            sb.Insert(0, " Hello ");
            MessageBox.Show(sb.ToString());
            sb.Insert(10," how r u ");
            MessageBox.Show(sb.ToString());
            sb.Remove(5, 2);
            MessageBox.Show(sb.ToString());
        }
    }
}







No comments:

Using Authorization with Swagger in ASP.NET Core

 Create Solution like below LoginModel.cs using System.ComponentModel.DataAnnotations; namespace UsingAuthorizationWithSwagger.Models {     ...