I have a string that can look like this: 12345, this 123456 or this: 1234567.
I’d like to make each string look like this: 123-45, this: 1234-56 or this: 12345-67.
How can I do this in C#?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
EDIT: Added check based on comment, but depends on how such strings should be handled. (e.g. dashed even if length = 2?)