How to use Contains method in c#.net

Contains :

"This methode will return true if your specified string is mathes in given string or return false "

How to Use :


       
     bool strmain.Contains(" string strsub")
     

Input Parameter :

         strsub = (string)
 

Output Parameter :

         strmain = (string)


Example  :: 

/////////////////////////  CODE   /////////////////////

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 Contains
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            string str = null;
            str = "Nirav daraniya is app developer";
            if (str.Contains("app") == true)
            {
                MessageBox.Show("The string Contains 'app' ");
            }
            else
            {
                MessageBox.Show("The String is not Contains 'app'");
            }
        }
    }
}



////////////////////////////////  OUTPUT   //////////////////////////////

The string Contains 'app'

//////////////////////////////////////////////////////////////////////////////////



--
/\/ir@\/  <(.'.)>

Comments

Popular posts from this blog

How to make and use web service in Microsoft Dynamics Navision.

How to use Format function in Microsoft Dynamics Navision.

How to create simple report in Microsoft Dynamics Navision.