c# - Wrap unknown count of string using replace -
sorry title, had hard time trying summarize this.
i'd replace unknown number of instances of string wrapper. i'd replace this:
test two:\t\t tab characters
with this:
test two:<span class="" style="white-space:pre">\t\t</span> tab characters
there number of \t characters in given string, , in multiple locations.
the reason i'm trying our software uses chilkat sent emails, , if html content contains tabs, these not shown @ receiving end. when sent, use \t represent tab, , when viewing source of received email, tabs there, outside source not:
outside source:
source:
i tested gmail, , wraps tabs:
i understand maybe chilkat issue, can't find on topic, if can around above, i'm willing try it.
use this
using system; using system.collections.generic; using system.linq; using system.text; using system.text.regularexpressions; namespace consoleapplication2 { class program { static void main(string[] args) { string input = "test two:\t\t tab characters"; string output = regex.replace(input, @"(\t+)", "<span class=\"\" style=\"white-space:pre\">$1</span>"); } } }
Comments
Post a Comment