예제 #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);
         }
     }
 }