Last active
May 7, 2025 12:14
-
-
Save Strelok78/53549647dc2806e8bb3c9e37df617db9 to your computer and use it in GitHub Desktop.
String.Split, split string by space
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace iJuniorPractice | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
string text = "In moonlit woods, whispers of ancient tales danced " + | |
"\n" + | |
"\n " + | |
"with shadows, weaving dreams beneath stars' gentle, timeless gaze."; | |
char[] splitSymbols = { ' ', ',', '\n' }; | |
String emptyWord = ""; | |
string[] textSplited = text.Split(splitSymbols); | |
foreach (var word in textSplited) | |
{ | |
if (word != emptyWord) | |
Console.WriteLine(word); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment