< Summary

Information
Class: DirectSight.Reporting.Builders.Rendering.StringHelper
Assembly DirectSight
File(s): /home/runner/work/DirectSight/DirectSight/DirectSight/Reporting/Builders/Rendering/StringHelper.cs
Line coverage
66%
Covered lines: 2
Uncovered lines: 1
Coverable lines: 3
Total lines: 30
Line coverage: 66.6%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Metrics

MethodBranch coverage Cyclomatic complexity NPath complexity Sequence coverage
ReplaceInvalidPathChars(...)100%11100%
ReplaceNonLetterChars(...)100%11100%
ReplaceInvalidXmlChars(...)100%110%

File(s)

/home/runner/work/DirectSight/DirectSight/DirectSight/Reporting/Builders/Rendering/StringHelper.cs

#LineLine coverage
 1using System.Text.RegularExpressions;
 2
 3namespace DirectSight.Reporting.Builders.Rendering;
 4
 5/// <summary>
 6/// Helper methods for <see cref="string"/>.
 7/// </summary>
 8public static class StringHelper
 9{
 10    /// <summary>
 11    /// Replaces the invalid chars in the given path.
 12    /// </summary>
 13    /// <param name="path">The path.</param>
 14    /// <returns>The path with replaced invalid chars.</returns>
 3615    public static string ReplaceInvalidPathChars(string path) => Regex.Replace(path, "[^\\w^\\.]", "_");
 16
 17    /// <summary>
 18    /// Replaces all non letter chars in the given string.
 19    /// </summary>
 20    /// <param name="text">The text.</param>
 21    /// <returns>The text with replaced invalid chars.</returns>
 7222    public static string ReplaceNonLetterChars(string text) => Regex.Replace(text, "[^\\w]", string.Empty);
 23
 24    /// <summary>
 25    /// Replaces the invalid XML chars in the given string.
 26    /// </summary>
 27    /// <param name="text">The text.</param>
 28    /// <returns>The text with replaced invalid chars.</returns>
 029    public static string ReplaceInvalidXmlChars(string text) => Regex.Replace(text, @"(?<![\uD800-\uDBFF])[\uDC00-\uDFFF
 30}