AalborgHTX

String manupulation

Apr 23rd, 2018
185
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.14 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 WindowsFormsApplication146
  12. {
  13.     public partial class Form1 : Form
  14.     {
  15.         public Form1()
  16.         {
  17.             InitializeComponent();
  18.         }
  19.  
  20.         private void btnUpper_Click(object sender, EventArgs e)
  21.         {
  22.             string temp = txtIndTekst.Text;
  23.             temp = temp.ToUpper();
  24.             lblUdtekst.Text = temp;
  25.         }
  26.  
  27.         private void btnLength_Click(object sender, EventArgs e)
  28.         {
  29.             string temp = txtIndTekst.Text;
  30.             int længde = temp.Length;
  31.             lblUdtekst.Text = længde.ToString();
  32.         }
  33.  
  34.         private void btnSubString_Click(object sender, EventArgs e)
  35.         {
  36.             string temp = txtIndTekst.Text;
  37.             int start = int.Parse(txtStart.Text);
  38.             int antal = int.Parse(txtAntal.Text);
  39.  
  40.             temp = temp.Substring(start, antal);
  41.             lblUdtekst.Text = temp;
  42.         }
  43.     }
  44. }
Advertisement
Add Comment
Please, Sign In to add comment