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:

enter image description here

source:

enter image description here

i tested gmail, , wraps tabs:

enter image description here

enter image description here

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

Popular posts from this blog

Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12:test (default-test) on project.Error occurred in starting fork -

windows - Debug iNetMgr.exe unhandle exception System.Management.Automation.CmdletInvocationException -

configurationsection - activeMq-5.13.3 setup configurations for wildfly 10.0.0 -