using System.Collections.Generic;
static void Main(string[] args)
string text1 = "Toto je ten text stringu";
Console.WriteLine("text: " + text1);
Console.WriteLine($"{text1[^3]} - toto je 3. poslední char stringu");
Console.WriteLine($"{qq} - toto je vypsaný 'char' ");
string palindrom = "Kuna nese nanuk";
Console.WriteLine("toto je provedení s X.Lenght - i");
for (int i = 1; i < palindrom.Length + 1; i++)
char c = palindrom[palindrom.Length - i];
Console.WriteLine("Toto je provedení s ^i");
for (int i = 1; i < palindrom.Length + 1; i++)
string capsLock = "jAK mICROSOFT wORD POZNA ZAPNUTY cAPSLOCK";
for (int x = 0; x < capsLock.Length; x++)
char pismeno = capsLock[x];
if (char.IsUpper(pismeno))
Console.Write(char.ToLower(pismeno));
Console.Write(char.ToUpper(pismeno));
string[] slova = new string[] { "kajak", "program", "rotor", "Czechitas", "madam", "Jarda", "radar", "nepotopen" };
for (int r = 0; r < slova.Length; r++)
Console.WriteLine(slova[r]);
Console.WriteLine("\nZde jsou vypsány jen palindromy:");
for (int l = 0; l < slova.Length; l++)
string porovnavaneSlovo = slova[l];
porovnavaneSlovo = porovnavaneSlovo.ToLower();
bool[] bools = new bool[slova.Length - 1];
List<char> charList = new List<char>();
for (int i = 0; i < (porovnavaneSlovo.Length); i++)
prvniChar = porovnavaneSlovo[i];
posledniChar = porovnavaneSlovo[^(i + 1)];
if (prvniChar == posledniChar)
foreach (char pismeno in charList)
string sifra = "Wzcpsob!qsbdf!.!hsbuvmvkj!b!ktfn!ob!Ufcf!qztoz";
List<char> desifrovaneChary = new List<char>();
Console.WriteLine("šifra:\n" + sifra + "\nByla rozšifrována:");
for (int u = 0; u < sifra.Length; u++)
char jednotlivePismeno = sifra[u];
int kodJednotlivehoPismene = (int)jednotlivePismeno;
kodJednotlivehoPismene--;
Console.Write((char)(kodJednotlivehoPismene));
Console.WriteLine($"\n@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\n");
string text = @"""Hurry up, boy!"" shouted Uncle Vernon from the kitchen. ""What are you
doing, checking for letter bombs?"" He chuckled at his own joke.
Harry went back to the kitchen, still staring at his letter. He handed
Uncle Vernon the bill and the postcard, sat down, and slowly began to
open the yellow envelope.
Uncle Vernon ripped open the bill, snorted in disgust, and flipped over
""Marge's ill,"" he informed Aunt Petunia. ""Ate a funny whelk. --.""
""Dad!"" said Dudley suddenly. ""Dad, Harry's got something!""
Harry was on the point of unfolding his letter, which was written on the
same heavy parchment as the envelope, when it was jerked sharply out of
his hand by Uncle Vernon.
""That's mine!"" said Harry, trying to snatch it back.
""Who'd be writing to you?"" sneered Uncle Vernon, shaking the letter open
with one hand and glancing at it. His face went from red to green faster
than a set of traffic lights. And it didn't stop there. Within seconds
it was the grayish white of old porridge.";
bool textMaSmysl = !string.IsNullOrEmpty(text);
Console.WriteLine("Text dava smysl - ".PadRight(padding) + (textMaSmysl == true));
int delkaTextu = text.Length;
Console.WriteLine("délka textu podle text.lenght : " + delkaTextu);
List<char> listCharu1 = new List<char>();
for (int y = 0; y < text.Length; y++)
Console.WriteLine("počet charů je: " + listCharu1.Count);
for (int x = 0; x < listCharu1.Count; x++)
if ((listCharu1[x] == ' '))
Console.WriteLine("délka textu bez mezer je: " + delkaTextu);
for (int x = 0; x < listCharu1.Count; x++)
if ((listCharu1[x] == '"'))
Console.WriteLine("délka textu bez mezer a bez uvozovek je: " + delkaTextu);
Console.WriteLine("Delka text je spravna - ".PadRight(padding) + (delkaTextu == 1001));
foreach (char c in listCharu1)
Pomlcka pomlcka = new Pomlcka();
string oddelovac = pomlcka.VytvorPomlcky();
Console.WriteLine("Oddelovac ma 20 pomlcek - ".PadRight(padding) + (oddelovac == "--------------------"));
bool jeStejne = (jmeno1.Equals(jmeno2, StringComparison.OrdinalIgnoreCase));
Console.WriteLine("Obe promenne obsahuji stejne jmeno - ".PadRight(padding) + jeStejne);
bool piseSeOMarge = text.Contains("Marge");
Console.WriteLine("V textu se zminuje Harryho 'teticka' - ".PadRight(padding) + (piseSeOMarge == true));
bool jeSpravneUkoncen = false;
char posledniZnak = text[^1];
if ((posledniZnak == '.') || (posledniZnak == '!') || (posledniZnak == '?'))
jeSpravneUkoncen = false;
Console.WriteLine("Text je spravne ukoncen interpunkci - ".PadRight(padding) + (jeSpravneUkoncen == true));
if ((string.Compare(blabol1, blabol2) == -1) || (string.Compare(blabol1, blabol2) == 0))
if ((string.Compare(vyseVabecede, blabol3) == -1) || (string.Compare(vyseVabecede, blabol3) == 0))
Console.WriteLine("Prvni v abecede je blabol3 - ".PadRight(padding) + (prvni == blabol3));
List<char> listCharu = new List<char>();
for (int y = 0; y < text.Length; y++)
int indexVykricnik = text.IndexOf("!");
int indexKonecPredchoziVety = 0;
for (int i = indexVykricnik; i >=0; i--)
if ((listCharu[i] == '.') || (listCharu[i] == '!') || (listCharu[i] == '?') || (i == 0))
i = indexKonecPredchoziVety;
for (int i = indexKonecPredchoziVety; i < indexVykricnik; i++)
veta = veta + listCharu[i];
Console.WriteLine("Prvni rozkazovaci veta je 'Hurry up, boy' - ".PadRight(padding) + (veta == "Hurry up, boy"));
for (int k = 0; k < listCharu.Count; k++)
if ((text[k + 1] == 'a') || (text[k + 1] == 'A'))
if ((text[k + 2] == 'n') || (text[k + 2] == 'N'))
if ((text[k + 3] == 'd') || (text[k + 3] == 'D'))
Console.WriteLine("Text obsahuje slovo 'and' celkem 5x' - ".PadRight(padding) + (pocetAnd == 5));
private int pocetPomlcek;
public Pomlcka(int pocetPomlcek)
this.pocetPomlcek = pocetPomlcek;
public string VytvorPomlcky()
for (int qqq = 1; qqq < pocetPomlcek; qqq++)
pomlcky = (pomlcky + "-");