For any function there arises three basic question--:
String-: In Computer Science String means "A set of consecutive characters".
Sub -: Sub is basically a Latin prefix which has several meaning but the best suitable meaning for here is "part of".
So, Substring means "Part of a string".
Here index denotes the postion from where you want to extract the string and length denotes up to how much character you need to extract.Both contains integer value.
Example :
int ind = Convert.ToInt32(txtIndex.Text);
int len = Convert.ToInt32(txtLength.Text);
Literal1.Text = TextBox1.Text.Substring(ind,len);
- What does it mean?
- Why is this?
- How it works?
What does it mean?
As we see SubString is a combination of two words "Sub" and "String".String-: In Computer Science String means "A set of consecutive characters".
Sub -: Sub is basically a Latin prefix which has several meaning but the best suitable meaning for here is "part of".
So, Substring means "Part of a string".
Why is this?
So, from definition its clear that the work of substring is to extract a part of string.How it works?
Syntax : Substring(index,length)Here index denotes the postion from where you want to extract the string and length denotes up to how much character you need to extract.Both contains integer value.
Example :
int ind = Convert.ToInt32(txtIndex.Text);
int len = Convert.ToInt32(txtLength.Text);
Literal1.Text = TextBox1.Text.Substring(ind,len);
No comments:
Post a Comment