Monday, 3 March 2014

Substring in .Net

Substring in .Net
string strAppTime = "11:30-Am";
string strHr = strAppTime.ToString().Substring(0, strAppTime.ToString().LastIndexOf(':'));
string strMin = strAppTime.ToString().Substring(strAppTime.ToString().LastIndexOf(':') + 1, 2);
string strAMPM = strAppTime.ToString().Substring(strAppTime.ToString().LastIndexOf('-') + 1);