First of all, here is my code:
namespace ConsoleApp1
{
class Program
{
static void Main(string[] args)
{
string str = "test1,test2,test3";
}
}
}
So, I want to split test1 test2 and test3 using substrings and give it out in a console via console.writeline(). I want to use the "," for it. I'm not allowed to use string.split. Could you help me?
.Split()?Regex.Split. It's notString.Split:Dstringis essentially an array ofchar. So you can very easily iterate through it, and accumulate the chars, until you reach a comma.