Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace Split
- {
- class Program
- {
- static void Main(string[] args)
- {
- string text = "Хочу работу, хочу деньги. Хочу квартиру и новый комп. Но мечтать не вредно, кхе.";
- char[] deleteableCharacters = {' ', ',', '.'};
- Console.WriteLine("Вариант с пробелами:");
- foreach (var word in text.Split(deleteableCharacters))
- {
- Console.WriteLine(word);
- }
- Console.WriteLine("\nВариант без пробелов:");
- foreach (var word in text.Split(deleteableCharacters, StringSplitOptions.RemoveEmptyEntries))
- {
- Console.WriteLine(word);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement