• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

ThreeMammals / Ocelot / 26761608736

01 Jun 2026 02:34PM UTC coverage: 0.0% (-95.4%) from 95.403%
26761608736

Pull #2394

github

web-flow
Merge e39fc0db2 into e4022a7d8
Pull Request #2394: Harden `FileConfigurationPoller` against timer reentrancy and callback thread leaks, and stabilize `TimeoutDelegatingHandler` timeout test

0 of 7112 relevant lines covered (0.0%)

0.0 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
src/Ocelot/Infrastructure/Extensions/StringExtensions.cs
1
namespace Ocelot.Infrastructure.Extensions;
2

3
public static class StringExtensions
4
{
5
    /// <summary>Indicates whether a specified string is <see langword="null"/>, empty, or consists only of white-space characters.</summary>
6
    /// <remarks>This is shortcut for the <see cref="string.IsNullOrWhiteSpace(string?)"/> method.</remarks>
7
    /// <param name="str">The string to test.</param>
8
    /// <returns><see langword="true"/> if the <paramref name="str"/> parameter is <see langword="null" /> or <see cref="string.Empty"/>, or if <paramref name="str"/> consists exclusively of white-space characters.</returns>
9
    public static bool IsEmpty(this string str) => string.IsNullOrWhiteSpace(str);
×
10
    public static bool IsNotEmpty(this string str) => !string.IsNullOrWhiteSpace(str);
×
11

12
    /// <summary>Defaults to the default string if the current string is null or empty.</summary>
13
    /// <remarks>Based on the <see cref="string.IsNullOrWhiteSpace(string?)"/> method.</remarks>
14
    /// <param name="str">The current string.</param>
15
    /// <param name="def">The default string.</param>
16
    /// <returns>The <paramref name="def"/> string if <paramref name="str"/> is empty; otherwise, the <paramref name="str"/> string.</returns>
17
    public static string IfEmpty(this string str, string def) => string.IsNullOrWhiteSpace(str) ? def : str;
×
18

19
    /// <summary>Removes the prefix from the beginning of the string repeatedly until all occurrences are eliminated.</summary>
20
    /// <param name="source">The string to trim.</param>
21
    /// <param name="prefix">The prefix string to remove.</param>
22
    /// <param name="comparison">The 2nd argument of the <see cref="string.StartsWith(string)"/> method.</param>
23
    /// <returns>A new <see cref="string"/> without the prefix all occurrences.</returns>
24
    public static string TrimPrefix(this string source, string prefix, StringComparison comparison = StringComparison.Ordinal)
25
    {
×
26
        if (source == null || string.IsNullOrEmpty(prefix))
×
27
        {
×
28
            return source;
×
29
        }
30

31
        var s = source;
×
32
        while (s.StartsWith(prefix, comparison))
×
33
        {
×
34
            s = s[prefix.Length..];
×
35
        }
×
36

37
        return s;
×
38
    }
×
39

40
    public const char Slash = '/';
41

42
    /// <summary>Ensures that the last char of the string is forward slash, '/'.</summary>
43
    /// <param name="source">The string to check its last slash char.</param>
44
    /// <returns>A <see cref="string"/> witl the last forward slash.</returns>
45
    public static string LastCharAsForwardSlash(this string source)
46
        => source.EndsWith(Slash) ? source : source + Slash;
×
47

48
    public static string Plural(this int count) => count == 1 ? string.Empty : "s";
×
49
    public static string Plural(this string source, int count) => count == 1 ? source : string.Concat(source, "s");
×
50
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc