asp.net - Search the word from given text and split into variable -
i have ckeditor text , want search particular word text , utilize info calculation.
for illustration whenever background-color rgb(r,g,b) encountered want split 3 variable r,g b variable , convert hex code . please help me out....
class programme { static void main(string[] args) { string htmltext = "style='background-color:rgb(191, 191, 191); style='background-color:rgb(196, 189, 151); style='background-color:rgb(217, 217, 217);"; console.writeline(htmltext); regex backgroundreplacer = new regex(@"style='background-color:rgb\((?<red>\d+),\s(?<green>\d+),\s(?<blue>\d+)\);"); string replaced = backgroundreplacer.replace(htmltext, new matchevaluator(program.backgroundtobgcolor )); console.writeline(replaced); console.readline(); } static string backgroundtobgcolor(match m) { int reddish = int.parse(m.groups["red"].value); int greenish = int.parse(m.groups["green"].value); int bluish = int.parse(m.groups["blue"].value); homecoming string.format("bgcolor='#{0:x}{1:x}{2:x}' style='", red, green, blue); } }
asp.net
No comments:
Post a Comment