C# Tutorial - Part 15-How to split a string by a specific character/symbol

preview_player
Показать описание
In this c# tutorial you will learn how to split a string if any character is found in your array using foreach and through the console application.

Thanks for watching.
Рекомендации по теме
Комментарии
Автор

Thank you man your video saved my Kudos to you.

sankalpmahajan
Автор

Thank you buddy, it really helped me. Good work

GabrielOliveira-mmdz
Автор

Oh, thank you man, really i think about this 5 hours)

nicearthes
Автор

You saved my day, i was struggling to split my string for the use of a regex. Thank you ;)

Reidakad
Автор

Ok so this doesn't really concern to what you are doing in this video but I've come across a problem.I'm making a password program in C# and I've basically finished it. I've made it so the password must have 8 or more characters and it must contain an uppercase letter and a lowercase letter and that the program will restart itself if those conditions are not met. That's great and all but there is one problem. When you are typing in the password you can see it in plain site. Even though this program serves no purpose but to create a password, I would like learn how to censor the characters while it still being written if you get what I mean. I want people to be able to type out the password with it either not showing up physically or it being hidden through asterisks or something like that. Can you help?

na-ktbs
Автор

can this be done with user input in a textbox rather than hardcoded text?

choppapeters
Автор

Tested it out and your code works. :)

using System;

namespace SplitStringByChar
{
class Program
{
static void Main(string[] args)
{
Char[] myChars = { '!', '?', '.', '\'' };
string greeting = "Hello? What's up, dawg? How's it goin'?!?!";

string[] newGreetingArr = greeting.Split(myChars);
//This doesn't work:

foreach(string x in newGreetingArr)
{
Console.WriteLine(x);
}
}
}
}

studywithrobin