CSharp examples for System:String Format
Get Results String With Hyphen
using System.Text.RegularExpressions; using System.Security; using System.Runtime.InteropServices; using System;//from ww w. ja v a 2s. co m public class Main{ public static string GetResultsWithHyphen(string input) { var output = ""; var start = 0; while (start < input.Length) { output += input.Substring(start, Math.Min(6, input.Length - start)) + "-"; start += 6; } return output.Trim('-'); } }