If solution 2 is not an option, you can still go for a regular expression that will extract the three parts of your initial string, allowing you to place your minus sign between them.
This should look like:
using System.Text.RegularExpressions;
public static string GetFormattedValue(string initial) {
string formatRegex = @"^(?<First>[\d]{7})(?<Second>[\d]{4})(?<Third>[\d]{3})$";
Regex r = new Regex(formatRegex, RegexOptions.Compiled | RegexOptions.CultureInvariant);
Match m = r.Match(initial);
if (m.Success) {
return string.Format("{0}-{1}-{2}", m.Groups["First"], m.Groups["Second"], m.Groups["Third"]);
}
else {
return string.Empty;
}
}
But this solution requires that all input strings share the same format.
Hope this helps.