开发者

how to extract an value in datatable column

datatable name : images under that i have one column called image

under(image column) i have   values 
image1-school
image2-college
image3-mba

Now i need to extract only school college mba values from that column

and bind these values in check bo开发者_JS百科x list

how to achive this one

thank you


// first I need to create a match to see if the input string is in the corrent form
Match match = Regex.Match("image1-school", @"^image\d-(.*)$", RegexOptions.IgnoreCase);
// the parenthesis in the Regular Expression meeans the content must be place in a group
// as groups are 1 based, the first group is group[1]
if (match.Success)
{
     // this string will have the value of whatever was within the parenthesis
     string theStringYouWant = Regex.Match("image1-school", @"^image\d-(.*)$", RegexOptions.IgnoreCase).Groups[1].Value;
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜