DEV Community

Sunnat Qayumov
Sunnat Qayumov

Posted on

3 3 3 3 3

10. String operations

a)Quyidagi kod nima qiladi?

string name = "John" ;
string upperName = name. ToUpper ();
Console. WriteLine (upperName);
Enter fullscreen mode Exit fullscreen mode

Javob: hamma harflarni kottadan yozib beradi;

b)Stringlarni birlashtirishning bir usulini keltiring.

Replace() metodi orqali ma'lum bir qatorni boshqa qiymatga almashtirish mumkin.
using System;
using System.Text;

class Program
{
    static void Main()
    {
        StringBuilder sb = new StringBuilder("Hello Beautiful World!");

        sb.Remove(6, 10);
        Console.WriteLine(sb.ToString()); 
    }
}
Enter fullscreen mode Exit fullscreen mode

c)Stringlarni solishtirish uchun qaysi metod ishlatiladi?

Agar siz stringlarning ma'lum bir tartibda
(masalan, katta-kichik harflarga qarab) 
solishtirishni xohlasangiz, compareTo() metodidan 
foydalanishingiz mumkin.
Enter fullscreen mode Exit fullscreen mode

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay