Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace Es_array
- {
- class Program
- {
- static void Main(string[] args)
- {
- /*
- s1=lenght: restituisce la lunghezza della stringa come int
- contains : verifica se il contenuto di una stringa è presente in un'altra e restituisce un valore booleano (True/False)
- indexOf : resituisce un valore in int che indica la posizione nella quale è contenuto tale carattere
- compareTo: confronta 2 stringhe e verifica se sono uguali: se sono uguali restuisce valore 0 se sono diverse -1
- Substring: restituisce il contenuto della stringa dalla posizione inserita in poi
- */
- string s1 = "gesù cristo";
- string s2 = "ao m";
- Console.WriteLine("La lunghezza della stringa è " + s1.Length);
- Console.WriteLine(s1.Contains(s2));
- Console.WriteLine(s1.IndexOf('c'));
- string s3 = "ciao";
- string s4 = "ciao";
- Console.WriteLine(s3.CompareTo(s4));
- string s5 = "pappagallo";
- Console.WriteLine(s5.Substring(5));
- Console.WriteLine(s5.Substring(5,5));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement