public static string AddConditionalLineBreaks(string text, string conditionalLineBreak, int length)
{
if (text == null)
{
return text;
}
return Regex.Replace(text, "(\\S{" + length + "})(?=\\S)", "$1" + conditionalLineBreak, RegexOptions.Compiled | RegexOptions.Multiline);
}
public static string AddConditionalLineBreaks(string text, int length)
{
return AddConditionalLineBreaks(text, "­", length);
}