a) Quyidagi kod nima qiladi?
string name = "John";
string upperName = name.ToUpper();
Console.WriteLine(upperName);
Natija: JOHN
b) Stringlarni birlashtirishning bir usulini keltiring.
string firstName = "John";
string lastName = "Doe";
string fullName = firstName + " " + lastName;
c) Stringlarni solishtirish uchun string.Compare() yoki Equals() metodi ishlatiladi.
string str1 = "Apple";
string str2 = "Banana";
int result = string.Compare(str1, str2);
Console.WriteLine(result);
Natija: -1 (Apple kichik Banana'dan)
Top comments (0)