c# split string problem - TechRepublic
Question
January 19, 2008 at 04:44 AM
kunaltilak

c# split string problem

by kunaltilak . Updated 18 years, 5 months ago

kunal
hello sir,
please help me out for a asp.net(c#) problem.
actually i want to make an online test series.
for that i want to paste each question with options into rich text box.
each question has 4 options(named: a. , b. , c. , d. ).
like this:
Question:
f is defined on [-1, 1] by
a. f is continuous if and only if a > 0
b. f(0) exists if and only if a > 1
c. f is bounded if and only if a  1 + c
d. none of these
a. , b. , c. ,d. are the options

i want to split these above question as:

f is defined on [-1, 1] by
f is continuous if and only if a > 0
f(0) exists if and only if a > 1
f is bounded if and only if a  1 + c
none of these

i think you clearly understand my problem.
please help me out.

my code is:

using System.Text.RegularExpressions;

string[] abc = Regex.Split(finalString, “( a. | b. |c. |d. )”);

foreach (string match in abc)
{

string FinalSplitString= match;

}
where final string is the string which i mention above.
My code is not working fine, suggest me some code so that I can access 5 string elements(1 question and 4 options)

please help me.
thanking you.

with regards,
kunal

This discussion is locked

All Comments