Replacing double quotes with html quote tags for a given string in C# -



Replacing double quotes with html quote tags for a given string in C# -

given c# string like: var str = "this string \"contains\" double quotes.";

i'd transform to: var str = "this string <q>contains</q> double quotes.";

i've got solution loops through , string.replaces double quotes <q> loop through , create every other <q> closing </q> tag. have feeling there's improve way or more understandable way though.

i utilize regex

var str = "this string \"contains\" double \"aaaaa\"quotes."; var str2 = regex.replace(str,@"""(.+?)""", m => "<b>" + m.groups[1].value + "</b>");

c# html string

Comments

Popular posts from this blog

xslt - DocBook 5 to PDF transform failing with error: "fo:flow" is missing child elements. Required content model: marker* -

mediawiki - How do I insert tables inside infoboxes on Wikia pages? -

SQL Server : need assitance parsing delimted data and returning a long concatenated string -