How to find a string between two begin and end strings in ASP.NET using C#? -


how find string between 2 begin , end strings in mvc4?

some examples:

d1 => d1 (result) d1-d3 => d1,d2,d3 (result) d5-d6 => d5,d6 (result) d4-d7 => d4,d5,d6,d7 (result) 

try code, set input value , output value

var input = "d1-d5"; string output = string.empty; if (input.indexof("-") > 0) {     var values = input.split('-');     int first = int.parse(system.text.regularexpressions.regex.match(values[0], @"\d+").value);     int second = int.parse(system.text.regularexpressions.regex.match(values[1], @"\d+").value);      (int = first; <= second; i++)     {         output += "d" + + ",";     }     output = output.remove(output.length - 1); } 

Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

javascript - jQuery .height() return 0 when visible but non-0 when hidden -