Insert Separator - CSharp System

CSharp examples for System:String Split

Description

Insert Separator

Demo Code


using System.Text.RegularExpressions;
using System.Text;
using System.Globalization;
using System.Collections.Generic;
using System;/*from  w w w.j  ava2s .  com*/

public class Main{
        public static string InsertSeparator(string input, string separator)
        {
            string ret = "";
            for (int i = 0; i < input.Length; i++)
            {
                ret += input.Substring(i, 1);
                if (i != input.Length - 1)
                    ret += separator;
            }
            return ret;
        }
}

Related Tutorials