"Substring in C# string Class returns a new string that is a substring of this string. The substring begins at the specified given index and extended up to the given length.."
How to Use :
string string.Substring(strat index,length)
Input Parameter :
start index = (Int)
length = (Int)
Output Parameter :
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 Substring
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
string str = null;
string retString = null;
str = "This is Nirav M. patel";
retString = str.Substring(6, 9);
MessageBox.Show(retString);
}
}
}
////////////////////////////// OUTPUT /////////////////////////
s Nirav M
///////////////////////////////////////////////////////////////////////////
How to Use :
string string.Substring(strat index,length)
Input Parameter :
start index = (Int)
length = (Int)
Output Parameter :
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 Substring
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
string str = null;
string retString = null;
str = "This is Nirav M. patel";
retString = str.Substring(6, 9);
MessageBox.Show(retString);
}
}
}
////////////////////////////// OUTPUT /////////////////////////
s Nirav M
///////////////////////////////////////////////////////////////////////////
--
/\/ir@\/ <(.'.)>
0 comments:
Post a Comment
Thanks for comment