Skip to content

Commit eee9dc0

Browse files
committed
feat(utilities): add string.JoinParagraph extension method
1 parent 7c34f11 commit eee9dc0

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

source/Nuke.Utilities/Text/String.Join.cs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,4 +156,18 @@ public static string JoinNewLine(this IEnumerable<string> values, PlatformFamily
156156
: "\n";
157157
return values.Join(newLine);
158158
}
159+
160+
/// <summary>
161+
/// Joins all strings as paragraphs (double new-line).
162+
/// </summary>
163+
[Pure]
164+
public static string JoinParagraph(this IEnumerable<string> values, PlatformFamily? platformFamily = null)
165+
{
166+
var newLine = !platformFamily.HasValue
167+
? Environment.NewLine
168+
: platformFamily.Value == PlatformFamily.Windows
169+
? "\r\n"
170+
: "\n";
171+
return values.Join(newLine + newLine);
172+
}
159173
}

0 commit comments

Comments
 (0)