I have a string which i need to increment by 1 The string has both characters and numeric values.
The string layout i have is as follows \"MD00494\"
How woul
string sDispatchNo = "MS00914";
var pattern = @"^[a-zA-Z]+";
var strPart = Regex.Match(sDispatchNo, pattern).Value;
var noPart = Regex.Replace(sDispatchNo, pattern, "");
var no = int.Parse(noPart);
var length = noPart.Length;
length = (no + 1)/(Math.Pow(10,length)) == 1 ? length + 1 : length;
var output = strPart + (no + 1).ToString("D" + length);