Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace p07_siruri_de_caractere
- {
- class Program
- {
- static void Main(string[] args)
- {
- ///String uri
- ///1.operatori ==, !=, =(atribuire), +(concatenare), +=
- string s, t;
- s = "caseta";
- t = "caserola";
- if (s == t) Console.WriteLine("Egale");
- else Console.WriteLine("Diferite");
- /// if (s < t) Console.WriteLine("s mai mic lexicografic decat t");
- s += t;
- Console.WriteLine(s);
- //2.Secvente si caractere Verbatim
- //Exaemple de secvente escape; \n, \t (tab)
- // \a(bip), \r \\ ,\', \"
- string cale = "d : \\12A\\csharp\\proiecte";
- Console.WriteLine(cale);
- string w = "Citez: \"Broasca nu oracaie pe uscat\"";
- Console.WriteLine(w);
- // ca sa scap de secventele escape folosesc
- // caractere verbatim
- string q = @"d:\ana\are\mere";
- Console.WriteLine(q);
- string x = @"Popescu
- Radu
- Alexandru
- Gabriel";
- Console.WriteLine(x);
- //3.Indexatori.Proprietate Length
- //afisare litere cu litere a unui string
- for (int i = 0; i < s.Length; i++)
- Console.Write(s[i]);
- Console.WriteLine("\n\n");
- // afisare de la drepta la stanga
- for(int i = s.Length - 1; i >=0 ; i--)
- Console.Write(s[i]);
- Console.WriteLine("\n\n");
- //Tipul string nu se initializeaza
- // folosind "new" ci prin atribuire
- //indexatorul tipul strig este Read-Only:
- // este eronat sa scriem s[2] = 'A';
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement