Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Вивчайте Рядок | Робота з типами даних
Основи C#

bookРядок

Рядок (string) — це послідовність символів. Рядки використовуються для зберігання текстових даних.

main.cs

main.cs

copy
1234567891011121314
using System; namespace ConsoleApp { internal class Program { static void Main(string[] args) { string text = "Hello, World!"; Console.WriteLine(text); // Output: Hello, World! } } }

Текстові дані (рядки) завжди беруться в подвійні лапки (").

Звісно, ми не можемо виконувати арифметичні операції над рядками, проте можемо використовувати оператор плюс (+) для об'єднання двох рядків. Процес об'єднання рядків за допомогою оператора плюс називається конкатенацією рядків.

main.cs

main.cs

copy
123456789101112131415
using System; namespace ConsoleApp { internal class Program { static void Main(string[] args) { string partOne = "The first sentence. "; string partTwo = "The second sentence."; string combined = partOne + partTwo; Console.WriteLine(combined); // Output: The first sentence. The second sentence. } } }

We can use the new line character (\n) to represent a new line in string data.

For-example:

main.cs

main.cs

copy
12345678910111213
using System; namespace ConsoleApp { internal class Program { static void Main(string[] args) { string text = "The first line.\nThe second line."; Console.WriteLine(text); } } }

When the \n character is encountered, the text automatically shifts to a new line. We can use multiple newline characters to skip multiple lines:

main.cs

main.cs

copy
12345678910111213
using System; namespace ConsoleApp { internal class Program { static void Main(string[] args) { string text = "The first line.\n\n\nThe second line.\nThe third line."; Console.WriteLine(text); } } }
question mark

What will be the output of the following code?

Select the correct answer

Все було зрозуміло?

Як ми можемо покращити це?

Дякуємо за ваш відгук!

Секція 2. Розділ 6

Запитати АІ

expand

Запитати АІ

ChatGPT

Запитайте про що завгодно або спробуйте одне із запропонованих запитань, щоб почати наш чат

Awesome!

Completion rate improved to 1.59

bookРядок

Свайпніть щоб показати меню

Рядок (string) — це послідовність символів. Рядки використовуються для зберігання текстових даних.

main.cs

main.cs

copy
1234567891011121314
using System; namespace ConsoleApp { internal class Program { static void Main(string[] args) { string text = "Hello, World!"; Console.WriteLine(text); // Output: Hello, World! } } }

Текстові дані (рядки) завжди беруться в подвійні лапки (").

Звісно, ми не можемо виконувати арифметичні операції над рядками, проте можемо використовувати оператор плюс (+) для об'єднання двох рядків. Процес об'єднання рядків за допомогою оператора плюс називається конкатенацією рядків.

main.cs

main.cs

copy
123456789101112131415
using System; namespace ConsoleApp { internal class Program { static void Main(string[] args) { string partOne = "The first sentence. "; string partTwo = "The second sentence."; string combined = partOne + partTwo; Console.WriteLine(combined); // Output: The first sentence. The second sentence. } } }

We can use the new line character (\n) to represent a new line in string data.

For-example:

main.cs

main.cs

copy
12345678910111213
using System; namespace ConsoleApp { internal class Program { static void Main(string[] args) { string text = "The first line.\nThe second line."; Console.WriteLine(text); } } }

When the \n character is encountered, the text automatically shifts to a new line. We can use multiple newline characters to skip multiple lines:

main.cs

main.cs

copy
12345678910111213
using System; namespace ConsoleApp { internal class Program { static void Main(string[] args) { string text = "The first line.\n\n\nThe second line.\nThe third line."; Console.WriteLine(text); } } }
question mark

What will be the output of the following code?

Select the correct answer

Все було зрозуміло?

Як ми можемо покращити це?

Дякуємо за ваш відгук!

Секція 2. Розділ 6
some-alt