ASP.NET - meaning for this statement

Asked By ravi t on 14-Apr-11 05:29 AM
 result = emailAddress.Substring(5,4)
Riley K replied to ravi t on 14-Apr-11 05:34 AM
Substring returns part of string from specified index

 for example string str = "konerushanmukh@yahoo.com";

         MessageBox.Show(str.Substring(5,3));// 5 is the start index, 3 is length

OutPut

ush
Jitendra Faye replied to ravi t on 14-Apr-11 05:35 AM
result = emailAddress.Substring(5,4)

IN THIS LINE YOU ARE TAKING SUB STRING FROM emailAddress string.

here you are strating taking string from 5th position to (5+4) 9th position.
suppose emailAddress="asdf@gmail.com";

then result= gmai

I hope this will help you.
Ravi S replied to ravi t on 14-Apr-11 05:35 AM
Hi
Kindly refer to this link.You will find the solution


http://www.homeandlearn.co.uk/net/nets7p5.html

TSN ... replied to ravi t on 14-Apr-11 05:36 AM
Hi...

Suppose if emailaddress: abcdefghj@gmail.com

then the result for the statement would be... result = emailAddress.Substring(5,4)

result=fghj; // becouse when 5 is the index startingposition from left  and 4 number of digits from that position

in the above "f" is at 5 th position and from there next 4 characters are taken...

hope this helps you...