示例#1
0
 private void btn_delete_substring_Click(object sender, EventArgs e)
 {
     if (txt_del_string.Text.Trim() == "")
     {
         MessageBox.Show("Enter string to delete");
         txt_del_string.Focus();
     }
     else
     {
         chain_process chain = new chain_process();
         txt_output.Text = chain.delete(txt_input.Text, txt_del_string.Text);
     }
 }
示例#2
0
 private void btn_occurrences_Click(object sender, EventArgs e)
 {
     if (txt_num_occurrences.Text.Trim() == "")
     {
         MessageBox.Show("Enter character to find");
         txt_num_occurrences.Focus();
     }
     else
     {
         chain_process chain = new chain_process();
         txt_output.Text = "Number of appeared: " + chain.Number(txt_input.Text, txt_num_occurrences.Text.Trim()).ToString();
     }
 }
示例#3
0
 private void btn_insert_string_Click(object sender, EventArgs e)
 {
     if (txt_insert.Text.Trim() == "")
     {
         MessageBox.Show("Enter string to insert");
         txt_insert.Focus();
     }
     else
     {
         chain_process chain = new chain_process();
         int           p     = int.Parse(txt_insert_position.Text);
         txt_output.Text = chain.insert(txt_input.Text, txt_insert.Text, p);
     }
 }
示例#4
0
 private void btn_change_substring_Click(object sender, EventArgs e)
 {
     if (txt_replace_string.Text.Trim() == "")
     {
         MessageBox.Show("Enter string to replace");
         txt_replace_string.Focus();
     }
     else
     {
         if (txt_new_string.Text.Trim() == "")
         {
             MessageBox.Show("Enter string to replace");
             txt_new_string.Focus();
         }
         else
         {
             chain_process chain = new chain_process();
             txt_output.Text = chain.change(txt_input.Text, txt_replace_string.Text, txt_new_string.Text);
         }
     }
 }