コード例 #1
0
ファイル: frmMain.cs プロジェクト: mcskik/Utilities
        private void joinToolStripMenuItem_Click(object sender, EventArgs e)
        {
            frmSplitJoinParameters parameters = new frmSplitJoinParameters();
            DialogResult           result     = parameters.ShowDialog();

            if (result == DialogResult.OK)
            {
                string delimiter = parameters.Delimiter;
                if (delimiter.Length > 0)
                {
                    string[]      lines = txtDocument.Lines;
                    StringBuilder sb    = new StringBuilder();
                    for (int index = 0; index < lines.Length - 1; index++)
                    {
                        var line = lines[index];
                        sb.Append(String.Format(@"{0}{1}", line, delimiter));
                    }
                    sb.Append(lines[lines.Length - 1]);
                    txtDocument.Text = sb.ToString();
                }
            }
        }
コード例 #2
0
ファイル: frmMain.cs プロジェクト: mcskik/Utilities
        private void splitToolStripMenuItem_Click(object sender, EventArgs e)
        {
            frmSplitJoinParameters parameters = new frmSplitJoinParameters();
            DialogResult           result     = parameters.ShowDialog();

            if (result == DialogResult.OK)
            {
                string delimiter = parameters.Delimiter;
                if (delimiter.Length > 0)
                {
                    string[]      lines = txtDocument.Text.Split(new string[] { delimiter }, StringSplitOptions.RemoveEmptyEntries);
                    StringBuilder sb    = new StringBuilder();
                    for (int index = 0; index < lines.Length - 1; index++)
                    {
                        var line = lines[index];
                        sb.AppendLine(line);
                    }
                    sb.Append(lines[lines.Length - 1]);
                    txtDocument.Text = sb.ToString();
                }
            }
        }