class phoneNumber { /*Returns phoneNum after spliting*/ public string splitPhone(string phoneNum) { if(phoneNum.Length > 9 && phoneNum.Substring(0,1)=="1") { phoneNum = phoneNum.Substring(1,9); } return phoneNum; } /*returns phone prefix*/ public string phonePrefix(string phoneNum) { if(phoneNum.Length > 7) { phoneNum.Substring(0,3); } return phoneNum; } /*returns phone suffix*/ public string phoneSuffix(string phoneNum) { if(phoneNum.Length > 7) { phoneNum.Substring(3,7); } return phoneNum; } } } }
First method splitPhone splits phoneNumber,second method phonePrefix returns phonePrefix,third method phoneSuffix returns phoneSuffix. How to replace Substring function in this methods with take and skip. Want to write this same code using take,skip in c sharp. please let me know how this could be done