How to cast the string with ' - ' with 2 characters by 2 characters???
For example: ABCCDEFF
Result: AB-CC-DE-FF
Kindly answer me if you have idea. Thanks a lot for viewing :-)
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Vipan SharmaRank #1,589 · 999 reputationPosted Apr 10, 2016, 10:47 PM EDT
st = Regex.Replace(st, ".{2}", "$0-");
st = st.Remove(st.Length - 1);
Vipan SharmaRank #1,589 · 999 reputationPosted Apr 10, 2016, 10:53 PM EDT
Asp.Net HeinRank #6,010 · 279 reputationPosted Apr 10, 2016, 10:51 PM EDT
Asp.Net HeinRank #6,010 · 279 reputationPosted Apr 10, 2016, 10:57 PM EDT
Vipan SharmaRank #1,589 · 999 reputationPosted Apr 10, 2016, 11:01 PM EDT
DhanasekarRank #3,343 · 430 reputationPosted Apr 10, 2016, 10:46 PM EDT