Advertisement
Guest User

Untitled

a guest
Jan 14th, 2018
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.53 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. using System.Windows.Forms;
  10.  
  11. namespace ManipulationString
  12. {
  13. public partial class Form1 : Form
  14. {
  15. public Form1()
  16. {
  17. InitializeComponent();
  18. }
  19.  
  20. private void changecase_Click(object sender, EventArgs e)
  21. {
  22. if (textBox1.Text == "")
  23. MessageBox.Show("Pilih jenis Metode");
  24. else if (comboBox1.SelectedIndex == 0)
  25. {
  26. string diupper = textBox1.Text;
  27. outputnya.Text = diupper.ToUpper();
  28. }
  29. else if (comboBox1.SelectedIndex == 1)
  30. {
  31. string diupper = textBox1.Text;
  32. outputnya.Text = diupper.ToLower();
  33. }
  34. }
  35.  
  36. private void trim_Click(object sender, EventArgs e)
  37. {
  38. string hapusspasi;
  39. hapusspasi = textBox2.Text;
  40. trimsoutput.Text = hapusspasi.Trim();
  41. }
  42.  
  43. private void indexof_Click(object sender, EventArgs e)
  44. {
  45. string stringEmail = textBox3.Text;
  46. int result = stringEmail.IndexOf(indexofinput.Text);
  47. if (result == -1)
  48. {
  49. MessageBox.Show("Invalid Email Address");
  50. }
  51. else
  52. {
  53. MessageBox.Show(" found at position"+result.ToString());
  54. }
  55. }
  56.  
  57. private void fileSystemWatcher1_Changed(object sender, System.IO.FileSystemEventArgs e)
  58. {
  59.  
  60. }
  61.  
  62. private void textBox1_TextChanged(object sender, EventArgs e)
  63. {
  64.  
  65. }
  66.  
  67. private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
  68. {
  69.  
  70. }
  71.  
  72. private void groupBox1_Enter(object sender, EventArgs e)
  73. {
  74.  
  75. }
  76.  
  77. private void constrain_Click(object sender, EventArgs e)
  78. {
  79. string user, pass;
  80. user = username.Text;
  81. pass = password.Text;
  82. if (user.Equals(pass))
  83. {
  84. MessageBox.Show("Jangan sama");
  85. }
  86. else
  87. {
  88. MessageBox.Show("berhasil");
  89. }
  90. }
  91.  
  92. private void join_Click(object sender, EventArgs e)
  93. {
  94. string inputjoin1, inputjoin2,gabungkan;
  95. inputjoin1 = join1.Text;
  96. inputjoin2 = join2.Text;
  97. gabungkan = inputjoin1 + inputjoin2;
  98. MessageBox.Show(gabungkan);
  99. }
  100.  
  101. private void outputnya_TextChanged(object sender, EventArgs e)
  102. {
  103.  
  104. }
  105.  
  106. private void button1_Click(object sender, EventArgs e)
  107. {
  108. if (padin.Text == "")
  109. MessageBox.Show("masukan inputan");
  110. else if (comboBox2.SelectedIndex == 0)
  111. {
  112. string inputan = padin.Text;
  113. padout.Text = inputan.PadLeft(10, 'x');
  114. }
  115. else if (comboBox2.SelectedIndex == 1)
  116. {
  117. string inputan = padin.Text;
  118. padout.Text = inputan.PadRight(10, 'x');
  119. }
  120. }
  121.  
  122. private void Replace_Click(object sender, EventArgs e)
  123. {
  124. string inputanreplace = inputrep.Text;
  125. string carireplace = carirep.Text;
  126. string hasilnyareplace = hasilnyarep.Text;
  127.  
  128. MessageBox.Show(inputanreplace.Replace(carireplace,hasilnyareplace));
  129.  
  130. }
  131.  
  132. private void removee_Click(object sender, EventArgs e)
  133. {
  134. string inputanreplace = inputrep.Text;
  135. string carireplace = carirep.Text;
  136.  
  137. MessageBox.Show(inputanreplace.Replace(carireplace, ""));
  138. }
  139.  
  140. private void insertbutton_Click(object sender, EventArgs e)
  141. {
  142. string inputaninsertvar = inputaninsert.Text;
  143. int sisipkankevar = Convert.ToInt16(sisipkanke.Text);
  144. string yangdisisipkanvar = ygdisisipkan.Text;
  145.  
  146. hasilinsert.Text = inputaninsertvar.Insert(sisipkankevar, yangdisisipkanvar);
  147.  
  148. }
  149.  
  150. private void groupBox8_Enter(object sender, EventArgs e)
  151. {
  152.  
  153. }
  154.  
  155. private void join2_TextChanged(object sender, EventArgs e)
  156. {
  157.  
  158. }
  159.  
  160. private void sisipkanke_TextChanged(object sender, EventArgs e)
  161. {
  162.  
  163. }
  164. }
  165. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement