Possible Duplicate:
How do I split a string by strings and include the delimiters using .NET?
I have following code:
string Test="abc * (xyz+ pqr) - 10/100";
char[] delimiters = new char[] { '+', '-', '*', '/', '(', ')' };
string[] parts = Test.Split(delimiters, StringSplitOptions.RemoveEmptyEntries);
for (int i = 0; i < parts.Length; i++)
{
Response.Write(parts[i]);
}
I m getting output as:
abc xyz pqr 10100
But i want:
abc
*
(
xyz
+
pqr
...and so on.
(in c# or in javascript)
after each element you're printing or they'll all stay on the same line. – beezir Jan 14 '13 at 16:21