Advertisement
AalborgHTX

String manipulation

Mar 25th, 2019
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.04 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 WindowsFormsApplication3
  12. {
  13.     public partial class Form1 : Form
  14.     {
  15.         public Form1()
  16.         {
  17.             InitializeComponent();
  18.         }
  19.  
  20.         private void btnContains_Click(object sender, EventArgs e)
  21.         {
  22.             string ind1 = txtInd1.Text;
  23.             string ind2 = txtInd2.Text;
  24.  
  25.             if (ind1.Contains(ind2))
  26.             {
  27.                 lblUd.Text = "YES";
  28.             }
  29.             else
  30.             {
  31.                 lblUd.Text = "NO";
  32.             }
  33.         }
  34.  
  35.         private void btnInsert_Click(object sender, EventArgs e)
  36.         {
  37.             string ind1 = txtInd1.Text;
  38.             string ind2 = txtInd2.Text;
  39.             int tal = int.Parse(txtTal.Text);
  40.  
  41.             ind1 = ind1.Insert(tal, ind2);
  42.             lblUd.Text = ind1;
  43.         }
  44.     }
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement