C# da String Metodlari ketdik
Birinchi bo'lib escape character va verbatim stringlari haqida gaplashsak.
.1 Escape character bu maxsus belgilarni chiqarish uchun ishlatiladi.
Masalan bu qo'shtirnoqlarni bakslajlarni chiqarish uchun ular oldidan
bitta bekslejni qo'ysak bas.
//code .
Console.WriteLine("Men bugun mana bu so'zni doskaga yozdim \"Bugun 1 darsimiz bor\"")
Mana bu bakslajlar qo'shtirnoqni chiqarishda kerak bo'ladi.
.2 Verbatim string bu - Masalan siz matni o'zgartirishsiz yozmoqchi bo'sayz aynan bu string metodidan foydalanasiz.
Buni strukturasini misolda tushunturaman.
//
Console.WriteLine(@"C: Windows\Desktop\C-sharp-module");
chiqarish uchun shunchaki uning oldiga @ belgisini qo'yib ketsak bas.
.3 Endi esa Contains metodini o'tsak Contains shunchaki bizni tilda aytsak bir matnni ichida biz qidirayotgan so'z bor yoki yo'qligini tekshiradi.
Uning ichida Startwith va Endwith metodlari ham bor.
Masalan siz bergan so'z ham matnni boshida ham oxirida bo'sa siz ularni aniqini aytish uchun bulardan foydalanasiz.
.4 Length - ha bu so'z inglizchada uzunlik deyiladi.
Matnda ham biror bir so'z.Length bu o'sha so'zning uzunligini chiqarib aniqlab beradi.
//English version
Let's go to String Methods in C#
Let's talk about escape character and verbatim strings first.
.1 Escape character is used to escape special characters.
For example, these quotation marks precede them to exclude backslashes
let's put one backslege.
//code .
Console.WriteLine("I wrote this word on the board today \"We have 1 lesson today\"")
These backslashes are needed to extract the quote.
.2 Verbatim string is - For example, if you want to write the text without changing it, you use this string method.
I will explain this structure with an example.
//
Console.WriteLine(@"C: Windows\Desktop\C-sharp-module");
to extract it, we just put the @ symbol in front of it.
.3 Now if we pass the Contains method, Contains will simply check if the word we are looking for is found in a text given by us in the language.
It also contains Startwith and Endwith methods.
For example, if the words you give are both at the beginning and at the end of the text, you use them to make them clear.
.4 Length - yes this word is called length in English.
A word in the text.Length determines the length of that word.
Top comments (1)
bu darsimiz ham o'z nihoyasiga yetdi