-
Split string with string
I have text like this
some text
&&
some text
&&
.....
I want to split text, and this code works
Code:
values = s.Split('&');
but it's not working if i place something like this
Code:
values = s.Split('&&');
because it only takes char
Thx for help
-
A resolution based on my interpretation of your problem...
Code:
using System.Text.RegularExpressions;
using System;
class SplitItUpApp
{
static void Main(string[] args)
{
string input = "What&&we have&&here&&is a failure&&to&&communicate";
Regex sp = new Regex(@"[&]+");
foreach (string output in sp.Split(input))
{
Console.WriteLine(output);
}
}
}
-
Code:
string str = "sometext&&watson&sons&&more text&&&&empty over there <--&&";
string[] array = str.Split(new string[] { "&&" }, StringSplitOptions.None);
foreach (string s in array)
Console.WriteLine(s);
replay was posted before but it lokks like there was some database failure so it's deleted