How to get the intermediate portion of string?

Niladri.Biswas
Posted by Niladri.Biswas under C# category on | Points: 40 | Views : 1335
I have a string as under

var input= "dbo.xyx.v1.UserDefinedFunction";

The desired output will be "xyx.v1";

Solution

string output= input.Substring(input.IndexOf('.') + 1, 
input.LastIndexOf('.') - input.IndexOf('.') - 1);

Comments or Responses

Login to post response